3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ping($host, $port, $timeout) { $tB = microtime(true); $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); if (!$fP) { return "down"; } $tA = microtime(true); return round((($tA - $tB) * 1000), 0)." ms"; } //Echoing it will display the ping if the host is up, if not it'll say "down". echo ping("www.google.com", 80, 10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4E8ot
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'ping'
          1        SEND_VAL                                                 'www.google.com'
          2        SEND_VAL                                                 80
          3        SEND_VAL                                                 10
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
          6      > RETURN                                                   1

Function ping:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4E8ot
function name:  ping
number of ops:  31
compiled vars:  !0 = $host, !1 = $port, !2 = $timeout, !3 = $tB, !4 = $fP, !5 = $errno, !6 = $errstr, !7 = $tA
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        INIT_FCALL                                               'microtime'
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !3, $8
    5     7        INIT_FCALL                                               'fsockopen'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        SEND_REF                                                 !5
         11        SEND_REF                                                 !6
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !4, $10
    6    15        BOOL_NOT                                         ~12     !4
         16      > JMPZ                                                     ~12, ->18
         17    > > RETURN                                                   'down'
    7    18    >   INIT_FCALL                                               'microtime'
         19        SEND_VAL                                                 <true>
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !7, $13
    8    22        INIT_FCALL                                               'round'
         23        SUB                                              ~15     !7, !3
         24        MUL                                              ~16     ~15, 1000
         25        SEND_VAL                                                 ~16
         26        SEND_VAL                                                 0
         27        DO_ICALL                                         $17     
         28        CONCAT                                           ~18     $17, '+ms'
         29      > RETURN                                                   ~18
    9    30*     > RETURN                                                   null

End of function ping

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.41 ms | 1403 KiB | 20 Q