test2 - 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 test2.php
- <?php
- class Pizdec {
- private $input;
- function __construct($input) {
- $this->input_arr = $input;
- }
- function arr_sort() {
- $arr = $this->input_arr;
- // var1: use pre-defined method;
- // sort($arr);
- // var2: use bulb sorting
- for($i = 0; $i < count($arr); $i++) {
- for($j = 0; $j < count($arr); $j++) {
- if($arr[$i] < $arr[$j]) {
- $temp = $arr[$j];
- $arr[$j] = $arr[$i];
- $arr[$i] = $temp;
- }
- }
- }
- return $arr;
- }
- }
- $array = array(12,4,60, 0);
- $pizdec = new Pizdec($array);
- $results = $pizdec->arr_sort();
- var_dump($results);
File Description
- test2
- PHP Code
- 16 Jan-2022
- 741 Bytes
You can Share it:
Latest PHP Pastes