3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DrawConnector { var $x0, $y0; var $R1; var $recx, $recy; //var $img; function __construct($img, $x0, $y0, $R1, $recx, $recy) { //$this -> img = $img; $this -> x0 = $x0; $this -> y0 = $y0; $this -> R1 = $R1; $this -> recx = $recx; $this -> recy = $recy; } function __draw($alpha1, $alpha2, $color) { $img = @ImageCreate (400, 400); $color = ImageColorAllocate ($img, 233, 0, 0); $blue = imagecolorallocate($img, 0, 0, 255); $alpha_delta = $alpha2 - $alpha1; $x1_0 = sin($alpha1) * $this -> R1; $y1_0 = cos($alpha1) * $this -> R1; $x2_0 = sin($alpha2) * $this -> R1; $y2_0 = cos($alpha2) * $this -> R1; $l = sqrt(($x2_0 - $x1_0) ^ 2 + ($y2_0 -$y1_0) ^ 2); If ($alpha_delta == pi()) { imageline($img, ($this -> x0 + ('1' - $this -> recx / $this -> R1 * '1.2') * $x1_0), ($this -> y0 + ('1' - $this -> recx / $this -> R1 * '1.2') * $y1_0), ($this -> x0 + ('1' - $this -> recx / $this -> R1 * '1.2') * $x2_0), ($this -> y0 + ('1' - $this -> recx / $this -> R1 * '1.2') * $y2_0), $color); } Else { $beta = ($alpha1 + $alpha2) / 2; $R1_kurz = $this -> R1 - $this -> recx * 1.2; $cx = sin($alpha1 + ($alpha2 - $alpha1) / 2) * $R1_kurz / cos(($alpha2 - $alpha1) / 2) + $this -> x0; $cy = cos($alpha1 + ($alpha2 - $alpha1) / 2) * $R1_kurz / cos(($alpha2 - $alpha1) / 2) + $this -> y0; $R2 = tan(($alpha2 - $alpha1) / 2) * $this -> R1; $R2_kurz = tan(($alpha2 - $alpha1) / 2) * $R1_kurz; $gamma = asin(($l / 2) / $R2); imagearc($img, '100', '100', '50', '50', '20', '60', $color); $cxx=$cx - $R2_kurz; $cyy=$cy - $R2_kurz; $R2_arc=$R2_kurz * '2'; $alpha_start=(-$gamma - $beta) / pi() * 180 - 90; $alpha_ende=($gamma - $beta) / pi() * 180; echo $cxx; echo $cyy; echo $R2; echo $alpha_start; echo $alpha_ende; //imagearc($img, $cxx, $cyy, $R2_arc, $R2_arc, $alpha_start, $alpha_ende, $color); header( "Content-type: image/png" ); imagepng($img); imagedestroy($img); } return null; } } $img = @ImageCreate (400, 400); $color = ImageColorAllocate ($img, 233, 0, 0); $blue = imagecolorallocate($img, 0, 0, 255); imagearc($img, '100', '100', '50', '50', '20', '60', $blue); //$DrawCon = new DrawConnector($img,'200','200','100','20','20'); //$DrawCon -> __draw($img, '0.1','0.2',$blue); header( "Content-type: image/png" ); imagepng($img); imagedestroy($img); ?>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught Error: Call to undefined function ImageCreate() in /in/loEQ0:115 Stack trace: #0 {main} thrown in /in/loEQ0 on line 115
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 5.1.3 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28

Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/loEQ0 on line 7 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/loEQ0 on line 9 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/loEQ0 on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1

preferences:
240.91 ms | 401 KiB | 324 Q