3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace bob; class a { function getNamespace() { $called_class = get_called_class(); return substr($called_class, 0, strrpos($called_class, "\\")); } } $a = new a(); print $a->getNamespace();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5CIOd
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'bob%5Ca'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   12     3        INIT_METHOD_CALL                                         !0, 'getNamespace'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Class bob\a:
Function getnamespace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5CIOd
function name:  getNamespace
number of ops:  14
compiled vars:  !0 = $called_class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_NS_FCALL_BY_NAME                                    'bob%5Cget_called_class'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
    7     3        INIT_NS_FCALL_BY_NAME                                    'bob%5Csubstr'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAL_EX                                              0
          6        INIT_NS_FCALL_BY_NAME                                    'bob%5Cstrrpos'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAL_EX                                              '%5C'
          9        DO_FCALL                                      0  $3      
         10        SEND_VAR_NO_REF_EX                                       $3
         11        DO_FCALL                                      0  $4      
         12      > RETURN                                                   $4
    8    13*     > RETURN                                                   null

End of function getnamespace

End of class bob\a.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.55 ms | 1395 KiB | 19 Q