replace array value in php in non associative array,so that the output will be $arr = array(1,3,4,5);
I want to replace today with 1.
How to replace 'today' with 1?
$arr = array('today',3,4,5);
replace array value in php in non associative array,so that the output will be $arr = array(1,3,4,5);
I want to replace today with 1.
How to replace 'today' with 1?
$arr = array('today',3,4,5);
You have to write like this code below
$arr = array('today', 3, 4, 5);
foreach ($arr as $key => $value) {
if ($value == 'today') {
$arr[$key] = 1;
}
}
Thanks