3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Création d'une image de 300x150 pixels $im = imagecreatetruecolor(300, 150); $black = imagecolorallocate($im, 0, 0, 0); $white = imagecolorallocate($im, 255, 255, 255); // Définit l'arrière-plan en blanc imagefilledrectangle($im, 0, 0, 299, 299, $white); // Chemin vers le fichier de police $font = './arial.ttf'; // Tout d'abord, nous créons notre rectangle entourant notre premier texte $bbox = imagettfbbox(10, 45, $font, 'Powered by PHP ' . phpversion()); // Nos coordonnées en X et en Y $x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) - 25; $y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5; // Dessin du texte imagettftext($im, 10, 45, $x, $y, $black, $font, 'Powered by PHP ' . phpversion()); // Nous créons notre rectangle entourant notre second texte $bbox = imagettfbbox(10, 45, $font, 'and Zend Engine ' . zend_version()); // Définit les coordonnées afin que le second text suive le premier $x = $bbox[0] + (imagesx($im) / 2) - ($bbox[4] / 2) + 10; $y = $bbox[1] + (imagesy($im) / 2) - ($bbox[5] / 2) - 5; // Dessin du texte imagettftext($im, 10, 45, $x, $y, $black, $font, 'and Zend Engine ' . zend_version()); // Affichage vers le navigateur header('Content-Type: image/png'); imagepng($im); imagedestroy($im); ?>
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in /in/nb99v:3 Stack trace: #0 {main} thrown in /in/nb99v on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Fatal error: Call to undefined function imagecreatetruecolor() in /in/nb99v on line 3
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: imagecreatetruecolor() in /in/nb99v on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: imagecreatetruecolor() in /in/nb99v on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: imagecreatetruecolor() in /in/nb99v on line 3

preferences:
153.7 ms | 401 KiB | 317 Q