3v4l.org

run code in 300+ PHP versions simultaneously
<?php class asset { protected $id; function __construct($id) { $this->id = $id; } function getId() { return $this->id; } } $getIdsCode = 'array_map(array("asset", "getId"),$input)'; // UPDATE THIS if (strpos($getIdsCode, ';') !== false) die('code should not contain ; !'); $getIdsCode = preg_replace('/\s+/', '', $getIdsCode); echo 'code length '.strlen($getIdsCode)."\n"; $input = array(new asset(10),new asset(20),new asset(30)); echo eval("return $getIdsCode;") . "\n"; $input = array(new asset(40),new asset(50),new asset(60)); echo eval("return $getIdsCode;") . "\n"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iSlSM
function name:  (null)
number of ops:  57
compiled vars:  !0 = $getIdsCode, !1 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, 'array_map%28array%28%22asset%22%2C+%22getId%22%29%2C%24input%29'
   19     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%3B'
          4        DO_ICALL                                         $3      
          5        TYPE_CHECK                                  1018          $3
          6      > JMPZ                                                     ~4, ->8
   20     7    > > EXIT                                                     'code+should+not+contain+%3B+%21'
   22     8    >   INIT_FCALL                                               'preg_replace'
          9        SEND_VAL                                                 '%2F%5Cs%2B%2F'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !0, $5
   24    14        STRLEN                                           ~7      !0
         15        CONCAT                                           ~8      'code+length+', ~7
         16        CONCAT                                           ~9      ~8, '%0A'
         17        ECHO                                                     ~9
   26    18        NEW                                              $10     'asset'
         19        SEND_VAL_EX                                              10
         20        DO_FCALL                                      0          
         21        INIT_ARRAY                                       ~12     $10
         22        NEW                                              $13     'asset'
         23        SEND_VAL_EX                                              20
         24        DO_FCALL                                      0          
         25        ADD_ARRAY_ELEMENT                                ~12     $13
         26        NEW                                              $15     'asset'
         27        SEND_VAL_EX                                              30
         28        DO_FCALL                                      0          
         29        ADD_ARRAY_ELEMENT                                ~12     $15
         30        ASSIGN                                                   !1, ~12
   27    31        ROPE_INIT                                     3  ~19     'return+'
         32        ROPE_ADD                                      1  ~19     ~19, !0
         33        ROPE_END                                      2  ~18     ~19, '%3B'
         34        INCLUDE_OR_EVAL                                  $21     ~18, EVAL
         35        CONCAT                                           ~22     $21, '%0A'
         36        ECHO                                                     ~22
   29    37        NEW                                              $23     'asset'
         38        SEND_VAL_EX                                              40
         39        DO_FCALL                                      0          
         40        INIT_ARRAY                                       ~25     $23
         41        NEW                                              $26     'asset'
         42        SEND_VAL_EX                                              50
         43        DO_FCALL                                      0          
         44        ADD_ARRAY_ELEMENT                                ~25     $26
         45        NEW                                              $28     'asset'
         46        SEND_VAL_EX                                              60
         47        DO_FCALL                                      0          
         48        ADD_ARRAY_ELEMENT                                ~25     $28
         49        ASSIGN                                                   !1, ~25
   30    50        ROPE_INIT                                     3  ~32     'return+'
         51        ROPE_ADD                                      1  ~32     ~32, !0
         52        ROPE_END                                      2  ~31     ~32, '%3B'
         53        INCLUDE_OR_EVAL                                  $34     ~31, EVAL
         54        CONCAT                                           ~35     $34, '%0A'
         55        ECHO                                                     ~35
   31    56      > RETURN                                                   1

Class asset:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iSlSM
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function __construct

Function getid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iSlSM
function name:  getId
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function getid

End of class asset.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.45 ms | 1392 KiB | 17 Q