3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Point { public $x; public $y; function __construct($x, $y) { $this->x = $x; $this->y = $y; } } $moves = 10; $mouseX = 100; $mouseY = 100; $point new Point(200, 200); $delta = 1/(1-rand(0, 99)/100); if (rand(0, 1) == 0) { $delta = 1/$delta; } $xCoefs = array($delta); for ( $i=1; $i<=$moves; $i++ ) { $xCoefs[$i] = $xCoefs[$i-1] - ($delta - 1/$delta)/$moves; } $points = array(new Point($mouseX, $mouseY)); for ( $i=1; $i<=$moves; $i++ ) { $x = $points[$i-1]->X + ($point->X - $points[$i-1]->X)*$xCoefs[$i]/$moves; $y = $points[$i-1]->Y + ($point->Y - $points[$i-1]->Y)/$moves; $points[] = new Point($x, $y); } var_dump($points);
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'new' (T_NEW) in /in/sheKG on line 16
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_NEW in /in/sheKG on line 16
Process exited with code 255.

preferences:
181.3 ms | 1395 KiB | 65 Q