3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public bool $bool = false; public int $int = 0; public string $string = ''; public array $arry = []; public stdClass $obj; public function __construct($value) { try { $this->bool = $value; } catch (TypeError $e) {} try { $this->int = $value; } catch (TypeError $e) {} try { $this->string = $value; } catch (TypeError $e) {} try { $this->arry = $value; } catch (TypeError $e) {} try { $this->obj = $value; } catch (TypeError $e) {} } } var_export(new Foo(null)); var_export(new Foo(true)); var_export(new Foo(10)); var_export(new Foo('text string')); var_export(new Foo(array(1,2,3)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Fg3uU
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'var_export'
          1        NEW                                              $0      'Foo'
          2        SEND_VAL_EX                                              null
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   20     6        INIT_FCALL                                               'var_export'
          7        NEW                                              $3      'Foo'
          8        SEND_VAL_EX                                              <true>
          9        DO_FCALL                                      0          
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                                 
   21    12        INIT_FCALL                                               'var_export'
         13        NEW                                              $6      'Foo'
         14        SEND_VAL_EX                                              10
         15        DO_FCALL                                      0          
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                                 
   22    18        INIT_FCALL                                               'var_export'
         19        NEW                                              $9      'Foo'
         20        SEND_VAL_EX                                              'text+string'
         21        DO_FCALL                                      0          
         22        SEND_VAR                                                 $9
         23        DO_ICALL                                                 
   23    24        INIT_FCALL                                               'var_export'
         25        NEW                                              $12     'Foo'
         26        SEND_VAL_EX                                              <array>
         27        DO_FCALL                                      0          
         28        SEND_VAR                                                 $12
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 4
Branch analysis from position: 4
2 jumps found. (Code = 107) Position 1 = 5, Position 2 = -2
Branch analysis from position: 5
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
Found catch point at position: 16
Branch analysis from position: 16
2 jumps found. (Code = 107) Position 1 = 17, Position 2 = -2
Branch analysis from position: 17
Found catch point at position: 20
Branch analysis from position: 20
2 jumps found. (Code = 107) Position 1 = 21, Position 2 = -2
Branch analysis from position: 21
filename:       /in/Fg3uU
function name:  __construct
number of ops:  22
compiled vars:  !0 = $value, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        ASSIGN_OBJ                                               'bool'
          2        OP_DATA                                                  !0
          3      > JMP                                                      ->5
          4  E > > CATCH                                       last         'TypeError'
   12     5    >   ASSIGN_OBJ                                               'int'
          6        OP_DATA                                                  !0
          7      > JMP                                                      ->9
          8  E > > CATCH                                       last         'TypeError'
   13     9    >   ASSIGN_OBJ                                               'string'
         10        OP_DATA                                                  !0
         11      > JMP                                                      ->13
         12  E > > CATCH                                       last         'TypeError'
   14    13    >   ASSIGN_OBJ                                               'arry'
         14        OP_DATA                                                  !0
         15      > JMP                                                      ->17
         16  E > > CATCH                                       last         'TypeError'
   15    17    >   ASSIGN_OBJ                                               'obj'
         18        OP_DATA                                                  !0
         19      > JMP                                                      ->21
         20  E > > CATCH                                       last         'TypeError'
   16    21    > > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.42 ms | 1400 KiB | 15 Q