Linked Questions
115 questions linked to/from Deleting an element from an array in PHP
175
votes
3
answers
281k
views
How to delete an array element based on key? [duplicate]
Possible Duplicate:
How to delete an element from an array in php?
For instance,
Array(
[0] => Array
(
[0] => hello
[1] => open
)
[...
40
votes
4
answers
82k
views
How to remove the first element of array without changing its key value? [duplicate]
There's an array in php
<?php
$array=array("a"=>"123","b"=>"234","c"=>"345");
array_shift($array);
//array("0"=>&...
21
votes
3
answers
55k
views
Delete row from php array [duplicate]
How can I remove an element from an array?
For example:
$data = Array('first' , 'second' , 'third');
array_delete($data[2]);
#$data would now read Array('first', 'second')
Does such a built-in ...
21
votes
4
answers
971
views
How can i delete a item at index X in array? [duplicate]
Possible Duplicate:
How to delete an element from an array in php?
I have a list of things, cars for instance
$cars[0] = "audi";
$cars[1] = "saab";
$cars[2] = "volvo";
$cars[3] = "vw";
How do i ...
4
votes
4
answers
10k
views
How to remove key value pairs from a PHP array if the key contains (matches) one or more substrings [duplicate]
I have an large array like (simplified for convenience):
Array
(
[last_name] => Ricardo
[first_name] => Montalban
[sex] => Yes please
[uploader_0_tmpname] => ...
9
votes
3
answers
834
views
Skip Submit button in array_keys [duplicate]
I've got a PHP routine that processes a form and outputs the values to a CSV file. I'm using array_keys() to create the header row (skipped if there is one). Everything works perfectly except the ...
4
votes
4
answers
1k
views
Remove part of associative array [duplicate]
I want to search an associative array and when I find a value, delete that part of the array.
Here is a sample of my array:
Array
(
[0] => Array
(
[id] => 2918
...
0
votes
2
answers
2k
views
PHP - Remove first result in array [duplicate]
I was wondering if someone could help me out.
I have a function that imports a CSV into an array, but i need to remove the first line with the
My CSV is formatted like so:
lat,lng,id
-34.837834,...
2
votes
2
answers
2k
views
Remove elements in a row of an array [duplicate]
I'm developing an API which produces results in JSON format, when I encoded results into JSON using PHP, it shows every element in the row of the array. I use MySQL to grab data.
foreach($search as $...
4
votes
3
answers
434
views
how to remove elements from a php array [duplicate]
I'm getting this array as a result of mysql query, then i need to remove some data from this array after conditional statement
`array(5) { [0]=> array(13)
{
["emp_name"]=> string(14) "...
-2
votes
2
answers
757
views
How to remove value and reassign remaining values to keys in array in PHP [duplicate]
The below code,
$test_array = array("a","b","c","d","e");
echo "<fieldset><pre>";
htmlspecialchars(print_r($test_array));
echo "</pre></fieldset>";
which gives output like,
...
2
votes
4
answers
414
views
How to check if array has some elements same as another array and to pop those elements out of array [duplicate]
I have an array like this:
array(1) {
[0]=>
string(16) "1785328791698338"
}
And other array like this:
array(7) {
[0]=>
string(17) "10207252567926988"
[1]=>
string(17) "...
0
votes
2
answers
319
views
Deleting from an array [duplicate]
i have an array that looks like this:
Array (
[0] => Array (
[id] => 18
[name] => book
[description] =>
[quantity] => 0
[price] => ...
1
vote
2
answers
250
views
Multiple values in array excluding specified key [duplicate]
I'm trying to verify if certain values exist within an array excluding a specific key:
$haystack = array(
"id" => 1,
"char1" => 2,
"char2" => 3,
&...
0
votes
6
answers
214
views
How to remove only item of array? [duplicate]
I have an array.
$a_input = array(1,2,3,4,5)
I want to remove 1 from array . out put is :
array(2,3,4,5);
remove 2 => output:
array(1,3,4,5);
remove 3 => output :
array(1,2,4,5);
.....
how to do ...