3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo\Bar\Baz { class Foo{} } namespace { class Bar{} function returnClass($content) { $className = get_class($content); $classNameWithoutNamespace = array_pop(explode('\\', $className)); return lcfirst($classNameWithoutNamespace); } $namespaced = returnClass(new \Foo\Bar\Baz\Foo()); $singleClass = returnClass(new \Bar()); var_dump($namespaced); var_dump($singleClass); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VjHLY
function name:  (null)
number of ops:  19
compiled vars:  !0 = $namespaced, !1 = $singleClass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'returnclass'
          1        NEW                                              $2      'Foo%5CBar%5CBaz%5CFoo'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $2
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !0, $4
   17     6        INIT_FCALL                                               'returnclass'
          7        NEW                                              $6      'Bar'
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $6
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !1, $8
   18    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
   19    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   20    18      > RETURN                                                   1

Function returnclass:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VjHLY
function name:  returnClass
number of ops:  16
compiled vars:  !0 = $content, !1 = $className, !2 = $classNameWithoutNamespace
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        GET_CLASS                                        ~3      !0
          2        ASSIGN                                                   !1, ~3
   12     3        INIT_FCALL                                               'array_pop'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%5C'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $5      
          8        SEND_VAR_NO_REF                               0          $5
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !2, $6
   14    11        INIT_FCALL                                               'lcfirst'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $8      
         14      > RETURN                                                   $8
   15    15*     > RETURN                                                   null

End of function returnclass

Class Foo\Bar\Baz\Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.97 ms | 1390 KiB | 23 Q