3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyLoadedMethods { protected $_data = array(); protected static $_instance; protected function set($key, $value){ static::$_instance->_data[$key] = $value; return static::$_instance; } protected function get($key){ if(array_key_exists($key, static::$_instance->_data)){ return static::$_instance->_data[$key]; } return null; } public static function getInstance() { if (!isset(static::$_instance)) { static::$_instance = new static; } return static::$_instance; } protected static function getFunction($name, $callback){ $ins = static::getInstance(); if(is_null(static::get($name))){ static::set($name, $callback); } return static::get($name); } public static function toBool($v) { $fn = static::getFunction(__FUNCTION__, function($value) { return $value == 1 || $value == true; }); return $fn($v); } public static function parseNewLines($v) { $fn = static::getFunction($v, function($value) { return trim(preg_replace('/\s\s+/', ' ', $string)); }); return $fn($v); } } var_dump(LazyLoadedMethods::toBool(-1));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'LazyLoadedMethods', 'toBool'
          2        SEND_VAL                                                 -1
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Ft4NcG%3A37%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/t4NcG
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   RECV                                             !0      
          1        IS_EQUAL                                         ~1      !0, 1
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   BOOL                                             ~2      !0
          4        BOOL                                             ~1      ~2
          5    > > RETURN                                                   ~1
          6*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft4NcG%3A37%240

Function %00%7Bclosure%7D%2Fin%2Ft4NcG%3A42%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $value, !1 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5Cs%5Cs%2B%2F'
          4        SEND_VAL                                                 '+'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
         10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ft4NcG%3A42%241

Class LazyLoadedMethods:
Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  set
number of ops:  9
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        FETCH_STATIC_PROP_W          unknown             $2      '_instance'
          3        FETCH_OBJ_W                                      $3      $2, '_data'
          4        ASSIGN_DIM                                               $3, !0
          5        OP_DATA                                                  !1
    9     6        FETCH_STATIC_PROP_R          unknown             ~5      '_instance'
          7      > RETURN                                                   ~5
   10     8*     > RETURN                                                   null

End of function set

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  get
number of ops:  11
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        FETCH_STATIC_PROP_R          unknown             ~1      '_instance'
          2        FETCH_OBJ_R                                      ~2      ~1, '_data'
          3        ARRAY_KEY_EXISTS                                         !0, ~2
          4      > JMPZ                                                     ~3, ->9
   14     5    >   FETCH_STATIC_PROP_R          unknown             ~4      '_instance'
          6        FETCH_OBJ_R                                      ~5      ~4, '_data'
          7        FETCH_DIM_R                                      ~6      ~5, !0
          8      > RETURN                                                   ~6
   16     9    > > RETURN                                                   null
   17    10*     > RETURN                                                   null

End of function get

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

End of function getinstance

Function getfunction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/t4NcG
function name:  getFunction
number of ops:  19
compiled vars:  !0 = $name, !1 = $callback, !2 = $ins
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        INIT_STATIC_METHOD_CALL                                  'getInstance'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !2, $3
   30     5        INIT_STATIC_METHOD_CALL                                  'get'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8        TYPE_CHECK                                    2          $5
          9      > JMPZ                                                     ~6, ->14
   31    10    >   INIT_STATIC_METHOD_CALL                                  'set'
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   33    14    >   INIT_STATIC_METHOD_CALL                                  'get'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $8      
         17      > RETURN                                                   $8
   34    18*     > RETURN                                                   null

End of function getfunction

Function tobool:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  toBool
number of ops:  12
compiled vars:  !0 = $v, !1 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   RECV                                             !0      
   37     1        INIT_STATIC_METHOD_CALL                                  'getFunction'
          2        SEND_VAL_EX                                              'toBool'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft4NcG%3A37%240'
          4        SEND_VAL_EX                                              ~2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   38     7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
   39    11*     > RETURN                                                   null

End of function tobool

Function parsenewlines:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t4NcG
function name:  parseNewLines
number of ops:  12
compiled vars:  !0 = $v, !1 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
   42     1        INIT_STATIC_METHOD_CALL                                  'getFunction'
          2        SEND_VAR_EX                                              !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ft4NcG%3A42%241'
          4        SEND_VAL_EX                                              ~2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   43     7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0  $5      
         10      > RETURN                                                   $5
   44    11*     > RETURN                                                   null

End of function parsenewlines

End of class LazyLoadedMethods.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.94 ms | 1408 KiB | 19 Q