How To Set All Zero In Last Position Using PHP 8
Hello Dev,
Immediately, i we’ll present you learn how to set all zero in final place utilizing PHP 8. This text gives you easy instance of learn how to set all zero in final place utilizing PHP 8. you’ll study get learn how to set all zero in final place utilizing PHP 8. So let’s comply with few step to create instance of learn how to set all zero in final place utilizing PHP 8.
Instance
<?php $array = [0,0,3,4,5,6,6]; perform move_zero($array) { $rely = 0; $arr_size= sizeof($array); for ($i = 0; $i < $arr_size; $i++ ){ if ($array[$i] != 0) { $array[$count++] = $array[$i]; } } whereas($rely < $arr_size){ $array[$count++] = 0; } return $array; } print_r(move_zero($array)); ?>
Output:
Array ( [0] => 3 [1] => 4 [2] => 5 [3] => 6 [4] => 6 [5] => 0 [6] => 0 )
I hope it should help you…
Komentar
Posting Komentar