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', ]; foreach ($tests AS $input => $expected) { $output = preg_replace(array('/(?<=[^A-Z])([A-Z])/', '/(?<=[^0-9])([0-9])/'), ' $0', $input); $output = ucwords($output); echo $output .' : '. ($output == $expected ? 'PASSED' : 'FAILED') . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/1KFKM
function name:  (null)
number of ops:  26
compiled vars:  !0 = $tests, !1 = $expected, !2 = $input, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1      > FE_RESET_R                                       $5      !0, ->24
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->24
          3    >   ASSIGN                                                   !2, ~6
   18     4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 <array>
          6        SEND_VAL                                                 '+%240'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   19    10        INIT_FCALL                                               'ucwords'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !3, $10
   20    14        CONCAT                                           ~12     !3, '+%3A+'
         15        IS_EQUAL                                                 !3, !1
         16      > JMPZ                                                     ~13, ->19
         17    >   QM_ASSIGN                                        ~14     'PASSED'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~14     'FAILED'
         20    >   CONCAT                                           ~15     ~12, ~14
         21        CONCAT                                           ~16     ~15, '%0A'
         22        ECHO                                                     ~16
   17    23      > JMP                                                      ->2
         24    >   FE_FREE                                                  $5
   21    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
220.51 ms | 1012 KiB | 15 Q