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_match_all('~(?:[^\\\\]*\\\\)*\K[A-Z][a-z]*~', $class, $words) ? $words[0] : [] ) ); echo "\n---\n"; } } echo testSnakeCasedModelNames();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MMFni
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 = 26
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/MMFni
function name:  testSnakeCasedModelNames
number of ops:  28
compiled vars:  !0 = $class, !1 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_CONSTANT                                   ~2      'testNamespacedClasses'
          1      > FE_RESET_R                                       $3      ~2, ->26
          2    > > FE_FETCH_R                                               $3, !0, ->26
   10     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~4      !0, '+%3D%3E+'
          5        ECHO                                                     ~4
   11     6        INIT_FCALL                                               'strtolower'
   12     7        INIT_FCALL                                               'implode'
          8        SEND_VAL                                                 '_'
   13     9        INIT_FCALL                                               'preg_match_all'
         10        SEND_VAL                                                 '%7E%28%3F%3A%5B%5E%5C%5C%5D%2A%5C%5C%29%2A%5CK%5BA-Z%5D%5Ba-z%5D%2A%7E'
         11        SEND_VAR                                                 !0
         12        SEND_REF                                                 !1
         13        DO_ICALL                                         $5      
         14      > JMPZ                                                     $5, ->18
         15    >   FETCH_DIM_R                                      ~6      !1, 0
         16        QM_ASSIGN                                        ~7      ~6
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~7      <array>
         19    >   SEND_VAL                                                 ~7
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                         $9      
         23        ECHO                                                     $9
   16    24        ECHO                                                     '%0A---%0A'
    9    25      > JMP                                                      ->2
         26    >   FE_FREE                                                  $3
   18    27      > RETURN                                                   null

End of function testsnakecasedmodelnames

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.48 ms | 1407 KiB | 20 Q