Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $numbers = [1,3,4,2,5,8,6,7,9];
- $seged = [];
- for($i = 0; $i<count($numbers); $i++)
- {
- foreach($numbers as $num)
- {
- if($i == $num)
- {
- $seged[] = $num;
- }
- }
- }
- $numbers = $seged;
- //print "<pre>";
- var_dump($numbers);
- //print "</pre>";
- //print_r($seged);
- //print "</br>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement