Home Backend Development PHP Tutorial 数组中过滤的有关问题

数组中过滤的有关问题

Jun 13, 2016 pm 01:34 PM
arr array quot shift substr

数组中过滤的问题

array('中国','人民',大中国');

因为‘中国’存在于‘大中国’中,我想让它去掉只留下
array('人民',大中国'); 

如何做,有没有什么函数?

------解决方案--------------------
用array_shift()函数

PHP code
$arr = array("hello","world","yes");
array_shift($arr);
print_r($arr);
<br><font color="#e78608">------解决方案--------------------</font><br>substr(0,6,array('中国','人民',大中国');  <br>就可以了 <div class="clear">
                 
              
              
        
            </div>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should I do if I can't switch between Chinese and English by pressing shift? What should I do if I can't switch between Chinese and English by pressing shift? Feb 22, 2023 pm 04:13 PM

Solution to the problem that pressing shift cannot switch between Chinese and English: 1. Find the win key and click to open; 2. Find "Settings" and click to open, then open "Time and Language"; 3. Click "Region and Language" and open "Options" "; 4. Click "Options" and then select "shift" in the first line.

What is the shift key on mac What is the shift key on mac Mar 13, 2023 pm 02:20 PM

The shift key of Mac is a key above the fn key and below the caps lock key. This key is on the far left side of the keyboard, the second key from the bottom right; the shift key is the upshift key in the keyboard, and can be accessed through " Ctrl+Shift" key combination to switch input methods.

What is ctrl plus shift? What is ctrl plus shift? Mar 09, 2023 pm 04:23 PM

ctrl+shift is a combination shortcut key for switching input methods; when pressing "ctrl+shift" at the same time, you can also hold down other keys to achieve other functions, such as pressing "ctrl+shift+N" at the same time key to create a new folder, etc.

How to unlock Win10 keyboard shift lock How to unlock Win10 keyboard shift lock Mar 31, 2024 am 11:51 AM

Recently, some friends have reported that they don’t know where to press, causing the shift key on the keyboard to be locked. What’s going on? How to solve this situation? Here I will give you a detailed introduction to Win10 You can take a look at how to unlock the keyboard shift lock. Undoing method: 1. Click "Start" in the taskbar in the lower left corner and select "Settings" in the menu list. 2. After entering the new interface, click the "Time and Language" option. 3. Then click "Region and Language" in the left column, then click "Advanced Keyboard Settings" in "Related Settings" on the right 4. Then click "Language Bar Options". 5. In the window that opens, click the "Advanced Key Settings" tab at the top. 6. Finally

Sort array using Array.Sort function in C# Sort array using Array.Sort function in C# Nov 18, 2023 am 10:37 AM

Title: Example of using the Array.Sort function to sort an array in C# Text: In C#, array is a commonly used data structure, and it is often necessary to sort the array. C# provides the Array class, which has the Sort method to conveniently sort arrays. This article will demonstrate how to use the Array.Sort function in C# to sort an array and provide specific code examples. First, we need to understand the basic usage of the Array.Sort function. Array.So

Which keyboard is shift? Which keyboard is shift? Feb 22, 2023 pm 02:51 PM

Shift is a shift key in the keyboard, also called the keyboard shift key, located in the lower left corner of the keyboard; the shift key has functions such as switching input methods, quickly switching between half-width and full-width, selecting consecutive files, and directly deleting files.

PHP returns the ASCII value of the first character of the string PHP returns the ASCII value of the first character of the string Mar 21, 2024 am 11:01 AM

This article will explain in detail the ASCII value of the first character of the string returned by PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP returns the ASCII value of the first character of a string Introduction In PHP, getting the ASCII value of the first character of a string is a common operation that involves basic knowledge of string processing and character encoding. ASCII values ​​are used to represent the numeric value of characters in computer systems and are critical for character comparison, data transmission and storage. The process of getting the ASCII value of the first character of a string involves the following steps: Get String: Determine the string for which you want to get the ASCII value. It can be a variable or a string constant

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

See all articles