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() { eval('$time = date("' . $this->format . '", strtotime("' . $this->prediction . '"));'); return isset($time) ? $time : 'Something went terribly wrong'; } } $format = "r"; $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/7S4GO
function name:  (null)
number of ops:  9
compiled vars:  !0 = $format, !1 = $timeModel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, 'r'
   19     1        NEW                                              $3      'TimeModel'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   20     5        INIT_METHOD_CALL                                         !1, 'getTime'
          6        DO_FCALL                                      0  $6      
          7        ECHO                                                     $6
   22     8      > RETURN                                                   1

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

End of function gettime

End of class TimeModel.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.37 ms | 1400 KiB | 17 Q