3v4l.org

run code in 300+ PHP versions simultaneously
<?php $logfile = $argv[1]; function doLog($msg) { global $logfile; $datestr = date("Y-M-d H:i:s T",time()); $msg="[".$datestr."]". $msg . "\n"; file_put_contents($logfile, $msg, FILE_APPEND); } doLog("Starting test"); $i = 0; while(true) { echo "Echoing a string to standard out!!!\n"; if((++$i % 10) == 0) { doLog("Completed $i iterations"); } } doLog("Script exited normally"); return 0; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 7
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 7
Branch analysis from position: 19
Branch analysis from position: 7
Branch analysis from position: 18
filename:       /in/XDAHk
function name:  (null)
number of ops:  24
compiled vars:  !0 = $logfile, !1 = $argv, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_DIM_R                                      ~3      !1, 1
          1        ASSIGN                                                   !0, ~3
   12     2        INIT_FCALL                                               'dolog'
          3        SEND_VAL                                                 'Starting+test'
          4        DO_FCALL                                      0          
   14     5        ASSIGN                                                   !2, 0
   15     6      > JMP                                                      ->18
   17     7    >   ECHO                                                     'Echoing+a+string+to+standard+out%21%21%21%0A'
   18     8        PRE_INC                                          ~7      !2
          9        MOD                                              ~8      ~7, 10
         10        IS_EQUAL                                                 ~8, 0
         11      > JMPZ                                                     ~9, ->18
   20    12    >   INIT_FCALL                                               'dolog'
         13        ROPE_INIT                                     3  ~11     'Completed+'
         14        ROPE_ADD                                      1  ~11     ~11, !2
         15        ROPE_END                                      2  ~10     ~11, '+iterations'
         16        SEND_VAL                                                 ~10
         17        DO_FCALL                                      0          
   15    18    > > JMPNZ                                                    <true>, ->7
   24    19    >   INIT_FCALL                                               'dolog'
         20        SEND_VAL                                                 'Script+exited+normally'
         21        DO_FCALL                                      0          
   25    22      > RETURN                                                   0
   26    23*     > RETURN                                                   1

Function dolog:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XDAHk
function name:  doLog
number of ops:  20
compiled vars:  !0 = $msg, !1 = $logfile, !2 = $datestr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        BIND_GLOBAL                                              !1, 'logfile'
    7     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'Y-M-d+H%3Ai%3As+T'
          4        INIT_FCALL                                               'time'
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !2, $4
    8     9        CONCAT                                           ~6      '%5B', !2
         10        CONCAT                                           ~7      ~6, '%5D'
         11        CONCAT                                           ~8      ~7, !0
         12        CONCAT                                           ~9      ~8, '%0A'
         13        ASSIGN                                                   !0, ~9
    9    14        INIT_FCALL                                               'file_put_contents'
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !0
         17        SEND_VAL                                                 8
         18        DO_ICALL                                                 
   10    19      > RETURN                                                   null

End of function dolog

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.28 ms | 1403 KiB | 22 Q