3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (isset($_POST['id'])) $id=stripslashes($_POST['id']); else { if (isset($_GET['id'])) $id=stripslashes($_GET['id']); else $id=""; } if (isset($_POST['cmd'])) $cmd=stripslashes($_POST['cmd']); else { if (isset($_GET['cmd'])) $cmd=stripslashes($_GET['cmd']); else $cmd=1; } function ahex2bin($s,$l) { for ($i = 0; $i < $l*2; $i += 2) { if($i < strlen($s)) $bin .= chr(hexdec(substr($s,$i,2))); else $bin .= chr(0); } return $bin; } $fp = fsockopen("udp://127.0.0.1", 80, $errno, $errstr); if (!$fp) { $answer="ERROR: $errno - $errstr<br>"; } else { $cmd = chr(0xfc).chr($cmd); $cmd = $cmd.ahex2bin($id,6).chr(0).chr(0).chr(0).chr(0).$data; if(fwrite($fp, $cmd)===FALSE) $answer="ERROR: write<br>"; else $answer="OK<br>"; fclose($fp); } echo $answer; ?>
Output for 8.0.13 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: fsockopen(): Unable to connect to udp://127.0.0.1:80 (Unknown error) in /in/e1kn9 on line 35 ERROR: 0 - <br>
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 Warning: fsockopen(): Unable to connect to udp://127.0.0.1:80 (Unknown error) in /in/e1kn9 on line 35 ERROR: 0 - <br>
Output for 8.0.0 - 8.0.12
Warning: Undefined variable $bin in /in/e1kn9 on line 30 Warning: Undefined variable $data in /in/e1kn9 on line 44 OK<br>
Output for 7.3.32 - 7.3.33, 7.4.26 - 7.4.33
Warning: fsockopen(): unable to connect to udp://127.0.0.1:80 (Unknown error) in /in/e1kn9 on line 35 ERROR: 0 - <br>
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25
Notice: Undefined variable: bin in /in/e1kn9 on line 30 Notice: Undefined variable: data in /in/e1kn9 on line 44 OK<br>
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
Warning: fsockopen(): unable to connect to udp://127.0.0.1:80 (Network is unreachable) in /in/e1kn9 on line 35 ERROR: 101 - Network is unreachable<br>
Output for 4.3.3 - 4.3.11, 4.4.0 - 4.4.9
Warning: fsockopen(): unable to connect to 127.0.0.1:80 in /in/e1kn9 on line 35 ERROR: 101 - Network is unreachable<br>
Output for 4.3.2
Warning: fsockopen(): php_hostconnect: connect failed in /in/e1kn9 on line 35 Warning: fsockopen(): unable to connect to 127.0.0.1:80 in /in/e1kn9 on line 35 ERROR: 101 - Network is unreachable<br>
Output for 4.3.0 - 4.3.1

Process exited with code 139.

preferences:
352.64 ms | 401 KiB | 459 Q