3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'LocalBusiness' => 'Local Business', 'CivicStructureBuilding' => 'Civic Structure Building', 'getUserMobilePhoneNumber' => 'Get User Mobile Phone Number', 'bandGuitar1' => 'Band Guitar 1', 'band2Guitar123' => 'Band 2 Guitar 123', 'CustomerIDWithSomeOtherJETWords' => 'Customer ID With Some Other JET Words', 'noOneIsMightierThanI' => 'No One Is Mightier Than I', 'USAIsNumber14' => 'USA Is Number 14', '99LuftBallons' => '99 Luft Ballons', 'fillOutYour403EForm' => 'Fill Out Your 403 E Form', 'ABC123IsEasyAs' => 'ABC 123 Is Easy As', ]; $result = []; foreach ($tests as $input => $expected) { $newString = ucwords( preg_replace( '/(?: [A-Z]+? (?=\d|[A-Z][a-z]) #acronyms |[A-Z]?[a-z]+ (?=[^a-z]) #words |\d+ (?=\D) #numbers |(*SKIP)(*FAIL) #abort )\K /x', ' ', $input ) ); $result[] = ($newString === $expected ? 'PASSED' : 'FAILED') . ': "' . $newString . '"'; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 25
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/J3NsP
function name:  (null)
number of ops:  30
compiled vars:  !0 = $tests, !1 = $result, !2 = $expected, !3 = $input, !4 = $newString
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   18     2      > FE_RESET_R                                       $7      !0, ->25
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->25
          4    >   ASSIGN                                                   !3, ~8
   19     5        INIT_FCALL                                               'ucwords'
   20     6        INIT_FCALL                                               'preg_replace'
   21     7        SEND_VAL                                                 '%2F%28%3F%3A%0A+++++++++++++++%5BA-Z%5D%2B%3F+++++++++%28%3F%3D%5Cd%7C%5BA-Z%5D%5Ba-z%5D%29++%23acronyms%0A+++++++++++++++%7C%5BA-Z%5D%3F%5Ba-z%5D%2B+++%28%3F%3D%5B%5Ea-z%5D%29+++++++++%23words%0A+++++++++++++++%7C%5Cd%2B++++++++++++%28%3F%3D%5CD%29+++++++++++++%23numbers%0A+++++++++++++++%7C%28%2ASKIP%29%28%2AFAIL%29++++++++++++++++++++%23abort%0A++++++++++++++%29%5CK%0A+++++++++++++%2Fx'
   28     8        SEND_VAL                                                 '+'
   29     9        SEND_VAR                                                 !3
   20    10        DO_ICALL                                         $10     
   29    11        SEND_VAR                                                 $10
   19    12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !4, $11
   32    14        IS_IDENTICAL                                             !4, !2
         15      > JMPZ                                                     ~14, ->18
         16    >   QM_ASSIGN                                        ~15     'PASSED'
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~15     'FAILED'
         19    >   CONCAT                                           ~16     ~15, '%3A+%22'
         20        CONCAT                                           ~17     ~16, !4
         21        CONCAT                                           ~18     ~17, '%22'
         22        ASSIGN_DIM                                               !1
         23        OP_DATA                                                  ~18
   18    24      > JMP                                                      ->3
         25    >   FE_FREE                                                  $7
   34    26        INIT_FCALL                                               'var_export'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.1 ms | 1008 KiB | 16 Q