Here is my code
$value = ["300","200","400","500"];
$remove = "300";
I want $value as ["200","400","500"];
please answer to this
Here is my code
$value = ["300","200","400","500"];
$remove = "300";
I want $value as ["200","400","500"];
please answer to this
You can use array_shift() as it will remove the first item in an array:
$value = ["300","200","400","500"];
$remove = array_shift($value);
print_r($value);
This will return:
Array
(
[0] => 200
[1] => 400
[2] => 500
)
$remove, not necessarily [0].$new = array_diff($value, (array) $remove); 3v4l.org/oDqMj that way you can supply either a string or array of values to remove.