How to find a value exist in an array and how to remove it. If any php builtin array functions for doing this. After removing I need the sequential index order. any body knows please help me.
To search an element in an array, you can use
You can refer: http://www.php.net/manual/en/ref.array.php for more array related functions. |
|||
|
You need to find the key of the array first, this can be done using array_search() Once done, use the unset()
|
|||||||||||||
|
Just in case you want to use any of mentioned codes, be aware that
The above example will output:
And that's good! |
|||
|
First of all, as others mentioned, you will be using the "array_search()" & the "unset()" methodsas shown below:-
Now to re-index the same array, without sorting any of the array values, you will need to use the "array_values()" method as shown below:-
Hope it helps. |
|||
|