3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TimeModel { public function __construct($format) { $this->format = addslashes($format); [ $d, $h, $m, $s ] = [ rand(1, 6), rand(1, 23), rand(1, 59), rand(1, 69) ]; $this->prediction = "+${d} day +${h} hour +${m} minute +${s} second"; } public function getTime() { echo $this->format; echo "\n"; eval('$time = date("' . $this->format . '", strtotime("' . $this->prediction . '"));'); return isset($time) ? $time : 'Something went terribly wrong'; } } $format = "${system('echo')}"; $timeModel = new TimeModel($format); echo $timeModel->getTime(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TijSk
function name:  (null)
number of ops:  14
compiled vars:  !0 = $format, !1 = $timeModel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'system'
          1        SEND_VAL                                                 'echo'
          2        DO_ICALL                                         $2      
          3        FETCH_R                      local               ~3      $2
          4        CAST                                          6  ~4      ~3
          5        ASSIGN                                                   !0, ~4
   21     6        NEW                                              $6      'TimeModel'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $6
   22    10        INIT_METHOD_CALL                                         !1, 'getTime'
         11        DO_FCALL                                      0  $9      
         12        ECHO                                                     $9
   24    13      > RETURN                                                   1

Class TimeModel:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TijSk
function name:  __construct
number of ops:  47
compiled vars:  !0 = $format, !1 = $d, !2 = $h, !3 = $m, !4 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'addslashes'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN_OBJ                                               'format'
          5        OP_DATA                                                  $6
    8     6        INIT_FCALL                                               'rand'
          7        SEND_VAL                                                 1
          8        SEND_VAL                                                 6
          9        DO_ICALL                                         $7      
         10        INIT_ARRAY                                       ~8      $7
         11        INIT_FCALL                                               'rand'
         12        SEND_VAL                                                 1
         13        SEND_VAL                                                 23
         14        DO_ICALL                                         $9      
         15        ADD_ARRAY_ELEMENT                                ~8      $9
         16        INIT_FCALL                                               'rand'
         17        SEND_VAL                                                 1
         18        SEND_VAL                                                 59
         19        DO_ICALL                                         $10     
         20        ADD_ARRAY_ELEMENT                                ~8      $10
         21        INIT_FCALL                                               'rand'
         22        SEND_VAL                                                 1
         23        SEND_VAL                                                 69
         24        DO_ICALL                                         $11     
         25        ADD_ARRAY_ELEMENT                                ~8      $11
         26        FETCH_LIST_R                                     $12     ~8, 0
         27        ASSIGN                                                   !1, $12
         28        FETCH_LIST_R                                     $14     ~8, 1
         29        ASSIGN                                                   !2, $14
         30        FETCH_LIST_R                                     $16     ~8, 2
         31        ASSIGN                                                   !3, $16
         32        FETCH_LIST_R                                     $18     ~8, 3
         33        ASSIGN                                                   !4, $18
         34        FREE                                                     ~8
    9    35        ROPE_INIT                                     9  ~22     '%2B'
         36        ROPE_ADD                                      1  ~22     ~22, !1
         37        ROPE_ADD                                      2  ~22     ~22, '+day+%2B'
         38        ROPE_ADD                                      3  ~22     ~22, !2
         39        ROPE_ADD                                      4  ~22     ~22, '+hour+%2B'
         40        ROPE_ADD                                      5  ~22     ~22, !3
         41        ROPE_ADD                                      6  ~22     ~22, '+minute+%2B'
         42        ROPE_ADD                                      7  ~22     ~22, !4
         43        ROPE_END                                      8  ~21     ~22, '+second'
         44        ASSIGN_OBJ                                               'prediction'
         45        OP_DATA                                                  ~21
   10    46      > RETURN                                                   null

End of function __construct

Function gettime:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TijSk
function name:  getTime
number of ops:  17
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~1      'format'
          1        ECHO                                                     ~1
   15     2        ECHO                                                     '%0A'
   16     3        FETCH_OBJ_R                                      ~2      'format'
          4        CONCAT                                           ~3      '%24time+%3D+date%28%22', ~2
          5        CONCAT                                           ~4      ~3, '%22%2C+strtotime%28%22'
          6        FETCH_OBJ_R                                      ~5      'prediction'
          7        CONCAT                                           ~6      ~4, ~5
          8        CONCAT                                           ~7      ~6, '%22%29%29%3B'
          9        INCLUDE_OR_EVAL                                          ~7, EVAL
   17    10        ISSET_ISEMPTY_CV                                         !0
         11      > JMPZ                                                     ~9, ->14
         12    >   QM_ASSIGN                                        ~10     !0
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~10     'Something+went+terribly+wrong'
         15    > > RETURN                                                   ~10
   18    16*     > RETURN                                                   null

End of function gettime

End of class TimeModel.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.25 ms | 1400 KiB | 19 Q