3v4l.org

run code in 300+ PHP versions simultaneously
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Logo to ASCII</title> <style> #logo { font-family: monospace; line-height: 0.6em; } </style> </head> <body> <?php try { $smallWidth = 100; $smallHeight = 100; $slLogo = "https://www.sololearn.com/images/fb-story-icon.jpg"; $img = imagecreatefromjpeg($slLogo); if ($img) { $width = imagesx($img); $height = imagesy($img); $smallImg = imagecreatetruecolor($smallWidth, $smallHeight); imagecopyresampled($smallImg, $img, 0, 0, 0, 0, $smallWidth, $smallHeight, $width, $height); echo "<div id='logo'>"; for ($y = 0; $y < $smallWidth; $y++) { for ($x = 0; $x < $smallHeight; $x++) { $color = imagecolorat($smallImg, $x, $y); $r = str_pad(dechex(($color >> 16) & 0xFF), 2, "0", STR_PAD_LEFT); $g = str_pad(dechex(($color >> 8) & 0xFF), 2, "0", STR_PAD_LEFT); $b = str_pad(dechex($color & 0xFF), 2, "0", STR_PAD_LEFT); echo "<i style='color:#$r$g$b'>*</i>"; } echo "<br>\n"; } echo "</div>"; imagedestroy($img); imagedestroy($smallImg); } } catch (Exception $e) { print_r($e->getMessage()); } ?> </body> </html>
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Logo to ASCII</title> <style> #logo { font-family: monospace; line-height: 0.6em; } </style> </head> <body> Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpeg() in /in/mRWPE:19 Stack trace: #0 {main} thrown in /in/mRWPE on line 19
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Logo to ASCII</title> <style> #logo { font-family: monospace; line-height: 0.6em; } </style> </head> <body> Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpeg() in /in/mRWPE:19 Stack trace: #0 {main} thrown in /in/mRWPE on line 19
Process exited with code 255.

preferences:
165.26 ms | 402 KiB | 168 Q