3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function __construct() { $this->arr = [1,34,3,98,9,76,45,4]; } function joinNumbers($a, $b) { $t=10; while($b>=$t) $t*=10; return $a*$t+$b; } function arrangeNumbers() { $size=count($this->arr)/count($this->arr[0]); for($i=0;$i<$size-1;$i++) { for($j=$i+1;$j<$size;$j++) { if(joinNumbers($this->arr[$i],$this->arr[$j])<joinNumbers($this->arr[$j],$this->arr[$i])) { $temp = $this->arr[$i]; $this->arr[$i] = $this->arr[$j]; $this->arr[$j] = $this->arr[$i]; } } } printf("Number is : "); for($i=0;$i<$size;$i++) { printf("%d",$this->arr[$i]); } printf("\n\n"); } } $test = new A; $test->arrangeNumbers();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property A::$arr is deprecated in /in/TbKPt on line 4 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, int given in /in/TbKPt:17 Stack trace: #0 /in/TbKPt(37): A->arrangeNumbers() #1 {main} thrown in /in/TbKPt on line 17
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.29 ms | 401 KiB | 8 Q