3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Profile_Model_Profile { protected $_userId; protected $_email; protected $_firstName; protected $_lastName; protected $_midName; /** * @var Core_Model_File */ protected $_cvFile; /** * @var Profile_Model_Affil */ protected $_affil; public function __isset($key) { return isset($this->{'_' . self::toCamelCase($key)}); } public function __get($key) { $property = '_' . self::toCamelCase($key); if (property_exists($this, $property)) { return $property; } throw new RuntimeException(sprintf('Invalid property: %s', $property)); } public function __set($key, $value) { $key = self::toCamelCase($key); $setter = 'set' . $key; if (method_exists($this, $setter)) { return $this->{$setter}($value); } $property = '_' . $key; if (property_exists($this, $property)) { $this->{$property} = $value; return; } throw new RuntimeException(sprintf('Invalid property: %s', $property)); } /** * Transform given string to camel-case. * * @param string $str * @return string */ public static function toCamelCase($str) { if (is_array($str) && isset($str[1])) { return strtoupper($str[1]); } return preg_replace_callback( '/_(\w)/', array(__CLASS__, __FUNCTION__), (string) $str ); } } echo Profile_Model_Profile::toCamelCase('to_jest_dupa_blada_html'), "\n"; echo Profile_Model_Profile::toCamelCase('to_jest_dupa_bladaHTML');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VX4J2
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   70     0  E >   INIT_STATIC_METHOD_CALL                                  'Profile_Model_Profile', 'toCamelCase'
          1        SEND_VAL                                                 'to_jest_dupa_blada_html'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
   71     5        INIT_STATIC_METHOD_CALL                                  'Profile_Model_Profile', 'toCamelCase'
          6        SEND_VAL                                                 'to_jest_dupa_bladaHTML'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9      > RETURN                                                   1

Class Profile_Model_Profile:
Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VX4J2
function name:  __isset
number of ops:  8
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        INIT_STATIC_METHOD_CALL                                  'toCamelCase'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        CONCAT                                           ~2      '_', $1
          5        ISSET_ISEMPTY_PROP_OBJ                           ~3      ~2
          6      > RETURN                                                   ~3
   24     7*     > RETURN                                                   null

End of function __isset

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/VX4J2
function name:  __get
number of ops:  22
compiled vars:  !0 = $key, !1 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1        INIT_STATIC_METHOD_CALL                                  'toCamelCase'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $2      
          4        CONCAT                                           ~3      '_', $2
          5        ASSIGN                                                   !1, ~3
   29     6        INIT_FCALL                                               'property_exists'
          7        FETCH_THIS                                       ~5      
          8        SEND_VAL                                                 ~5
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->13
   30    12    > > RETURN                                                   !1
   32    13    >   NEW                                              $7      'RuntimeException'
         14        INIT_FCALL                                               'sprintf'
         15        SEND_VAL                                                 'Invalid+property%3A+%25s'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $8      
         18        SEND_VAR_NO_REF_EX                                       $8
         19        DO_FCALL                                      0          
         20      > THROW                                         0          $7
   33    21*     > RETURN                                                   null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/VX4J2
function name:  __set
number of ops:  38
compiled vars:  !0 = $key, !1 = $value, !2 = $setter, !3 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   37     2        INIT_STATIC_METHOD_CALL                                  'toCamelCase'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   39     6        CONCAT                                           ~6      'set', !0
          7        ASSIGN                                                   !2, ~6
   40     8        INIT_FCALL                                               'method_exists'
          9        FETCH_THIS                                       ~8      
         10        SEND_VAL                                                 ~8
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $9      
         13      > JMPZ                                                     $9, ->18
   41    14    >   INIT_METHOD_CALL                                         !2
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0  $10     
         17      > RETURN                                                   $10
   44    18    >   CONCAT                                           ~11     '_', !0
         19        ASSIGN                                                   !3, ~11
   45    20        INIT_FCALL                                               'property_exists'
         21        FETCH_THIS                                       ~13     
         22        SEND_VAL                                                 ~13
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $14     
         25      > JMPZ                                                     $14, ->29
   46    26    >   ASSIGN_OBJ                                               !3
         27        OP_DATA                                                  !1
   47    28      > RETURN                                                   null
   50    29    >   NEW                                              $16     'RuntimeException'
         30        INIT_FCALL                                               'sprintf'
         31        SEND_VAL                                                 'Invalid+property%3A+%25s'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                         $17     
         34        SEND_VAR_NO_REF_EX                                       $17
         35        DO_FCALL                                      0          
         36      > THROW                                         0          $16
   51    37*     > RETURN                                                   null

End of function __set

Function tocamelcase:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/VX4J2
function name:  toCamelCase
number of ops:  19
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   RECV                                             !0      
   61     1        TYPE_CHECK                                  128  ~1      !0
          2      > JMPZ_EX                                          ~1      ~1, ->5
          3    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~2      !0, 1
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->11
   62     6    >   INIT_FCALL                                               'strtoupper'
          7        FETCH_DIM_R                                      ~3      !0, 1
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10      > RETURN                                                   $4
   64    11    >   INIT_FCALL                                               'preg_replace_callback'
   65    12        SEND_VAL                                                 '%2F_%28%5Cw%29%2F'
         13        SEND_VAL                                                 <array>
         14        CAST                                          6  ~5      !0
         15        SEND_VAL                                                 ~5
         16        DO_ICALL                                         $6      
         17      > RETURN                                                   $6
   67    18*     > RETURN                                                   null

End of function tocamelcase

End of class Profile_Model_Profile.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.02 ms | 1404 KiB | 23 Q