3v4l.org

run code in 300+ PHP versions simultaneously
<?php ////////// CONFIGURATION ///////////////// $ips_array=array("PC_1_NAME:172.19.144.10","PC_2_NAME:172.19.144.11","PC_3_NAME:172.19.144.10"); function ping($PC,$ip){ $cmd=shell_exec("ping -c 1 -w 200 $ip"); $dati_mount=explode(",",$cmd); if (eregi ("0", $dati_mount[1], $out)) {$connesso="<img src=\"off.gif\">";} if (eregi ("1", $dati_mount[1], $out)) {$connesso="<img src=\"on.gif\">";} $esito="$connesso [$ip] <b>$PC</b><br>"; return $esito; } while(list($k,$v)=each($ips_array)){ $dati_ip=explode(":",$v); $esito=ping($dati_ip[0],$dati_ip[1]); echo $esito; }
Output for 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 each() in /in/Qn2Jt:14 Stack trace: #0 {main} thrown in /in/Qn2Jt on line 14
Process exited with code 255.
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.3 - 7.4.33
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/Qn2Jt on line 14 Warning: shell_exec(): Unable to execute 'ping -c 1 -w 200 172.19.144.10' in /in/Qn2Jt on line 5 Fatal error: Uncaught Error: Call to undefined function eregi() in /in/Qn2Jt:8 Stack trace: #0 /in/Qn2Jt(16): ping('PC_1_NAME', '172.19.144.10') #1 {main} thrown in /in/Qn2Jt on line 8
Process exited with code 255.
Output for 7.2.0 - 7.2.13, 7.3.0 - 7.3.12, 7.4.0
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/Qn2Jt on line 14 Fatal error: Uncaught Error: Call to undefined function eregi() in /in/Qn2Jt:8 Stack trace: #0 /in/Qn2Jt(16): ping('PC_1_NAME', '172.19.144.10') #1 {main} thrown in /in/Qn2Jt on line 8
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: shell_exec(): Unable to execute 'ping -c 1 -w 200 172.19.144.10' in /in/Qn2Jt on line 5 Fatal error: Uncaught Error: Call to undefined function eregi() in /in/Qn2Jt:8 Stack trace: #0 /in/Qn2Jt(16): ping('PC_1_NAME', '172.19.144.10') #1 {main} thrown in /in/Qn2Jt on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25
Fatal error: Uncaught Error: Call to undefined function eregi() in /in/Qn2Jt:8 Stack trace: #0 /in/Qn2Jt(16): ping('PC_1_NAME', '172.19.144.10') #1 {main} thrown in /in/Qn2Jt on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38
Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_1_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.11] <b>PC_2_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Deprecated: Function eregi() is deprecated in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_3_NAME</b><br>
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_1_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.11] <b>PC_2_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_3_NAME</b><br>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_1_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.11] <b>PC_2_NAME</b><br> Notice: Undefined offset: 1 in /in/Qn2Jt on line 8 Notice: Undefined offset: 1 in /in/Qn2Jt on line 9 Notice: Undefined variable: connesso in /in/Qn2Jt on line 10 [172.19.144.10] <b>PC_3_NAME</b><br>

preferences:
265.74 ms | 403 KiB | 420 Q