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

数组中过滤的有关问题

Jun 13, 2016 am 10:18 AM
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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 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

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.

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

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

Simple and clear method to use PHP array_merge_recursive() function Simple and clear method to use PHP array_merge_recursive() function Jun 27, 2023 pm 01:48 PM

When programming in PHP, we often need to merge arrays. PHP provides the array_merge() function to complete array merging, but when the same key exists in the array, this function will overwrite the original value. In order to solve this problem, PHP also provides an array_merge_recursive() function in the language, which can merge arrays and retain the values ​​of the same keys, making the program design more flexible. array_merge

See all articles