3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classes = array('DateInterval', 'DateTimeImmutable', 'DateTime', 'DateTimeZone'); foreach ($classes as $class){ echo "Signature of $class::_set_state\n"; try{ $rm = new ReflectionMethod($class, '__set_state'); var_dump($rm->getNumberOfParameters()); var_dump($rm->getNumberOfRequiredParameters()); } catch(Exception $e) { echo "$class: " . $e; } } echo "End of param counts for __set_state\n\n"; try { var_export(DateTime::__set_state(array( 'date' => '2017-06-08 05:11:40.907706', 'timezone_type' => 3, 'timezone' => 'UTC', ))); } catch(Error $e) { echo "Couldn't call DateTime::__set_state: " . $e . "\n"; } // DateTime::__set_state(); // would trigger Warning: DateTime::__set_state() expects exactly 1 parameter, 0 given in php shell code on line 1 // needs 2, datefmt and bool, according to docs (not 100% sure) echo "datefmt_set_lenient\n"; $rf = new ReflectionFunction('datefmt_set_lenient'); var_dump($rf->getNumberOfParameters()); var_dump($rf->getNumberOfRequiredParameters());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 29
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Found catch point at position: 23
Branch analysis from position: 23
2 jumps found. (Code = 107) Position 1 = 24, Position 2 = -2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Found catch point at position: 38
Branch analysis from position: 38
2 jumps found. (Code = 107) Position 1 = 39, Position 2 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jEmee
function name:  (null)
number of ops:  58
compiled vars:  !0 = $classes, !1 = $class, !2 = $rm, !3 = $e, !4 = $rf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_R                                       $6      !0, ->29
          2    > > FE_FETCH_R                                               $6, !1, ->29
    6     3    >   ROPE_INIT                                     3  ~8      'Signature+of+'
          4        ROPE_ADD                                      1  ~8      ~8, !1
          5        ROPE_END                                      2  ~7      ~8, '%3A%3A_set_state%0A'
          6        ECHO                                                     ~7
    8     7        NEW                                              $10     'ReflectionMethod'
          8        SEND_VAR_EX                                              !1
          9        SEND_VAL_EX                                              '__set_state'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $10
    9    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !2, 'getNumberOfParameters'
         14        DO_FCALL                                      0  $13     
         15        SEND_VAR                                                 $13
         16        DO_ICALL                                                 
   10    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !2, 'getNumberOfRequiredParameters'
         19        DO_FCALL                                      0  $15     
         20        SEND_VAR                                                 $15
         21        DO_ICALL                                                 
         22      > JMP                                                      ->28
   11    23  E > > CATCH                                       last         'Exception'
   12    24    >   NOP                                                      
         25        FAST_CONCAT                                      ~17     !1, '%3A+'
         26        CONCAT                                           ~18     ~17, !3
         27        ECHO                                                     ~18
    5    28    > > JMP                                                      ->2
         29    >   FE_FREE                                                  $6
   17    30        ECHO                                                     'End+of+param+counts+for+__set_state%0A%0A'
   19    31        INIT_FCALL                                               'var_export'
         32        INIT_STATIC_METHOD_CALL                                  'DateTime', '__set_state'
   20    33        SEND_VAL                                                 <array>
         34        DO_FCALL                                      0  $19     
         35        SEND_VAR                                                 $19
         36        DO_ICALL                                                 
         37      > JMP                                                      ->42
   24    38  E > > CATCH                                       last         'Error'
   25    39    >   CONCAT                                           ~21     'Couldn%27t+call+DateTime%3A%3A__set_state%3A+', !3
         40        CONCAT                                           ~22     ~21, '%0A'
         41        ECHO                                                     ~22
   31    42    >   ECHO                                                     'datefmt_set_lenient%0A'
   32    43        NEW                                              $23     'ReflectionFunction'
         44        SEND_VAL_EX                                              'datefmt_set_lenient'
         45        DO_FCALL                                      0          
         46        ASSIGN                                                   !4, $23
   33    47        INIT_FCALL                                               'var_dump'
         48        INIT_METHOD_CALL                                         !4, 'getNumberOfParameters'
         49        DO_FCALL                                      0  $26     
         50        SEND_VAR                                                 $26
         51        DO_ICALL                                                 
   34    52        INIT_FCALL                                               'var_dump'
         53        INIT_METHOD_CALL                                         !4, 'getNumberOfRequiredParameters'
         54        DO_FCALL                                      0  $28     
         55        SEND_VAR                                                 $28
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.9 ms | 1405 KiB | 17 Q