3v4l.org

run code in 300+ PHP versions simultaneously
<?php const testNamespacedClasses = [ "Namespace\To\SettingOption", "I\Was\Born\InTheUSAIwas", "Something\Onething" ]; function testSnakeCasedModelNames() { foreach (testNamespacedClasses as $class) { echo "$class => "; echo strtolower( implode('_', preg_split('~(?:[^\\\\]+\\\\)+|(?=[A-Z])~', $class, null, PREG_SPLIT_NO_EMPTY) ) ); echo "\n---\n"; } } echo testSnakeCasedModelNames();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ITjTk
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CONST                                            'testNamespacedClasses', <array>
   20     1        INIT_FCALL                                               'testsnakecasedmodelnames'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function testsnakecasedmodelnames:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 22
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/ITjTk
function name:  testSnakeCasedModelNames
number of ops:  24
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_CONSTANT                                   ~1      'testNamespacedClasses'
          1      > FE_RESET_R                                       $2      ~1, ->22
          2    > > FE_FETCH_R                                               $2, !0, ->22
   10     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~3      !0, '+%3D%3E+'
          5        ECHO                                                     ~3
   11     6        INIT_FCALL                                               'strtolower'
   12     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 '_'
   13     9        INIT_FCALL                                               'preg_split'
         10        SEND_VAL                                                 '%7E%28%3F%3A%5B%5E%5C%5C%5D%2B%5C%5C%29%2B%7C%28%3F%3D%5BA-Z%5D%29%7E'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 null
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $4      
         15        SEND_VAR                                                 $4
         16        DO_ICALL                                         $5      
         17        SEND_VAR                                                 $5
         18        DO_ICALL                                         $6      
         19        ECHO                                                     $6
   16    20        ECHO                                                     '%0A---%0A'
    9    21      > JMP                                                      ->2
         22    >   FE_FREE                                                  $2
   18    23      > RETURN                                                   null

End of function testsnakecasedmodelnames

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.78 ms | 1399 KiB | 20 Q