$arr = ["250","250","500","500","250"];
Here is my $arr array. I want to replace 300 instead of 500.
Sample:
["250","250","300","300","250"]; //Output
Here is my code
$length = sizeof($arr);
for($i = 0; $i < $length; $i++)
{
if($arr[$i] <= 300)
{
}
else
{
$replace = array($i => "300");
array_replace($arr, $replace);
}
}