3v4l.org

run code in 300+ PHP versions simultaneously
<?php function converTo($date, $format = 'Y-m-d', $default = null, callable $funcExc = null ) { if (empty($date)) { return $default; } if (!is_string($format)) { throw new \InvalidArgumentException("Неверный формат"); } try { if (!($date instanceof \DateTime)) { if (is_numeric($date) && ( strlen($timestamp) == 13 || strlen($timestamp) == 10 )) { $date = new \DateTime("@" . $date); } elseif (strtotime($date) !== false) { $date = new \DateTime("@" . strtotime($date)); } else { $date = new \DateTime($date); } } if(!($date = $date->format($format))) { throw new \InvalidArgumentException("Произошла ошибка при приведению к заданному формату: " . $format); } } catch (\Exception $e) { if ($funcExc !== null) { call_user_func($funcExc, $date); } throw $e; } return $date; } var_dump(converTo("23/02/2013")); die; abstract class T { static public $instanses; final private function __construct(){ } public static function getInstance() { if (!(static::$instanses instanceof static)) { static::$instanses = new static; } return static::$instanses; } } class A extends T { static public $instanses; } class B extends A { static public $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/GNtdU
function name:  (null)
number of ops:  23
compiled vars:  !0 = $t, !1 = $t1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'converto'
          2        SEND_VAL                                                 '23%2F02%2F2013'
          3        DO_FCALL                                      0  $2      
          4        SEND_VAR                                                 $2
          5        DO_ICALL                                                 
   33     6      > EXIT                                                     
   63     7*       INIT_STATIC_METHOD_CALL                                  'A', 'getInstance'
          8*       DO_FCALL                                      0  $4      
          9*       ASSIGN                                                   !0, $4
   64    10*       INIT_FCALL                                               'var_dump'
         11*       SEND_VAR                                                 !0
         12*       DO_ICALL                                                 
   66    13*       INIT_STATIC_METHOD_CALL                                  'B', 'getInstance'
         14*       DO_FCALL                                      0  $7      
         15*       ASSIGN                                                   !1, $7
   67    16*       INIT_FCALL                                               'var_dump'
         17*       SEND_VAR                                                 !1
         18*       DO_ICALL                                                 
   69    19*       NEW                                              $10     'B'
         20*       DO_FCALL                                      0          
         21*       FREE                                                     $10
   71    22*     > RETURN                                                   1

Function converto:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 53
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 27
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 35
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 49
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
Branch analysis from position: 64
Branch analysis from position: 27
Branch analysis from position: 28
Branch analysis from position: 53
Found catch point at position: 65
Branch analysis from position: 65
2 jumps found. (Code = 107) Position 1 = 66, Position 2 = -2
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 71
Branch analysis from position: 68
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 71
filename:       /in/GNtdU
function name:  converTo
number of ops:  74
compiled vars:  !0 = $date, !1 = $format, !2 = $default, !3 = $funcExc, !4 = $timestamp, !5 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'Y-m-d'
          2        RECV_INIT                                        !2      null
          3        RECV_INIT                                        !3      null
    4     4        ISSET_ISEMPTY_CV                                         !0
          5      > JMPZ                                                     ~6, ->7
    5     6    > > RETURN                                                   !2
    7     7    >   TYPE_CHECK                                   64  ~7      !1
          8        BOOL_NOT                                         ~8      ~7
          9      > JMPZ                                                     ~8, ->14
    8    10    >   NEW                                              $9      'InvalidArgumentException'
         11        SEND_VAL_EX                                              '%D0%9D%D0%B5%D0%B2%D0%B5%D1%80%D0%BD%D1%8B%D0%B9+%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82'
         12        DO_FCALL                                      0          
         13      > THROW                                         0          $9
   11    14    >   INSTANCEOF                                       ~11     !0, 'DateTime'
         15        BOOL_NOT                                         ~12     ~11
         16      > JMPZ                                                     ~12, ->53
   12    17    >   INIT_FCALL                                               'is_numeric'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $13     
         20      > JMPZ_EX                                          ~14     $13, ->28
         21    >   STRLEN                                           ~15     !4
         22        IS_EQUAL                                         ~16     ~15, 13
         23      > JMPNZ_EX                                         ~16     ~16, ->27
         24    >   STRLEN                                           ~17     !4
         25        IS_EQUAL                                         ~18     ~17, 10
         26        BOOL                                             ~16     ~18
         27    >   BOOL                                             ~14     ~16
         28    > > JMPZ                                                     ~14, ->35
   13    29    >   NEW                                              $19     'DateTime'
         30        CONCAT                                           ~20     '%40', !0
         31        SEND_VAL_EX                                              ~20
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !0, $19
         34      > JMP                                                      ->53
   14    35    >   INIT_FCALL                                               'strtotime'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $23     
         38        TYPE_CHECK                                  1018          $23
         39      > JMPZ                                                     ~24, ->49
   15    40    >   NEW                                              $25     'DateTime'
         41        INIT_FCALL                                               'strtotime'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $26     
         44        CONCAT                                           ~27     '%40', $26
         45        SEND_VAL_EX                                              ~27
         46        DO_FCALL                                      0          
         47        ASSIGN                                                   !0, $25
         48      > JMP                                                      ->53
   17    49    >   NEW                                              $30     'DateTime'
         50        SEND_VAR_EX                                              !0
         51        DO_FCALL                                      0          
         52        ASSIGN                                                   !0, $30
   20    53    >   INIT_METHOD_CALL                                         !0, 'format'
         54        SEND_VAR_EX                                              !1
         55        DO_FCALL                                      0  $33     
         56        ASSIGN                                           ~34     !0, $33
         57        BOOL_NOT                                         ~35     ~34
         58      > JMPZ                                                     ~35, ->64
   21    59    >   NEW                                              $36     'InvalidArgumentException'
         60        CONCAT                                           ~37     '%D0%9F%D1%80%D0%BE%D0%B8%D0%B7%D0%BE%D1%88%D0%BB%D0%B0+%D0%BE%D1%88%D0%B8%D0%B1%D0%BA%D0%B0+%D0%BF%D1%80%D0%B8+%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D0%B4%D0%B5%D0%BD%D0%B8%D1%8E+%D0%BA+%D0%B7%D0%B0%D0%B4%D0%B0%D0%BD%D0%BD%D0%BE%D0%BC%D1%83+%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D1%83%3A+', !1
         61        SEND_VAL_EX                                              ~37
         62        DO_FCALL                                      0          
         63      > THROW                                         0          $36
         64    > > JMP                                                      ->72
   23    65  E > > CATCH                                       last         'Exception'
   24    66    >   TYPE_CHECK                                  1020          !3
         67      > JMPZ                                                     ~39, ->71
   25    68    >   INIT_USER_CALL                                1          'call_user_func', !3
         69        SEND_USER                                                !0
         70        DO_FCALL                                      0          
   27    71    > > THROW                                         0          !5
   30    72    > > RETURN                                                   !0
   31    73*     > RETURN                                                   null

End of function converto

Class T:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GNtdU
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/GNtdU
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   46     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   49     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   50    10*     > RETURN                                                   null

End of function getinstance

End of class T.

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GNtdU
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/GNtdU
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   46     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   49     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   50    10*     > RETURN                                                   null

End of function getinstance

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GNtdU
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/GNtdU
function name:  getInstance
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'instanses'
          1        INSTANCEOF                                       ~1      ~0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->8
   46     4    >   NEW                          static              $4      
          5        DO_FCALL                                      0          
          6        ASSIGN_STATIC_PROP                                       'instanses'
          7        OP_DATA                                                  $4
   49     8    >   FETCH_STATIC_PROP_R          unknown             ~6      'instanses'
          9      > RETURN                                                   ~6
   50    10*     > RETURN                                                   null

End of function getinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.02 ms | 1415 KiB | 20 Q