selection sort - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of selection sort.php
- <?php
- $values= array(1,4,10,3,30,14,5);
- $size = count($values);
- for($i=0;$i<=$size;$i++)
- {
- for($j=$i+1;$j<=$size;$j++)
- {
- if($values[$j] < $values[$i])
- {
- $min = $values[$j];
- $values[$j] = $values[$i];
- $values[$i] = $min;
- }
- }
- print $values[$i]."\n";
- }
File Description
- selection sort
- PHP Code
- 11 Jan-2021
- 386 Bytes
You can Share it:
Latest PHP Pastes