3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.1.0
Notice: Undefined variable: img in /in/Xeab1 on line 127 Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129 Fatal error: Uncaught Error: Call to undefined function ImageCreate() in /in/Xeab1:37 Stack trace: #0 /in/Xeab1(129): DrawConnector->__draw(NULL, '0.1', '0.2', NULL) #1 {main} thrown in /in/Xeab1 on line 37
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: img in /in/Xeab1 on line 127 Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129 200272.196830163465.0041708375539-111.2838203878515.554242436546 Warning: Cannot modify header information - headers already sent in /in/Xeab1 on line 101 �PNG  IHDR���q��PLTE���.*IDATx��1 �O�o��7O�9�xIEND�B`� Notice: Undefined variable: img in /in/Xeab1 on line 135 Warning: imagedestroy() expects parameter 1 to be resource, null given in /in/Xeab1 on line 135
Output for 5.1.3 - 5.6.28
Notice: Undefined variable: img in /in/Xeab1 on line 127 Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129
Process exited with code 255.
Output for 5.0.4 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 7 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 9 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 11 Notice: Undefined variable: img in /in/Xeab1 on line 127 Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 7 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 9 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/Xeab1 on line 11 Notice: Undefined variable: img in /in/Xeab1 on line 127 Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: img in /in/Xeab1 on line 129 Notice: Undefined variable: blue in /in/Xeab1 on line 129