3v4l.org

run code in 300+ PHP versions simultaneously
<?php $geo = 'New york, Ny columbia, sc charleston washington, DC BISMARCK, ND'; $geo = explode(PHP_EOL, $geo); foreach ($geo as $str) { // chop $str = explode(',', $str); // fix echo (!empty($str[0]) ? ucwords(strtolower(trim($str[0]))) : null). (!empty($str[1]) ? ', '.strtoupper(trim($str[1])) : null).PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 47
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 47
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 28
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 42
Branch analysis from position: 32
Branch analysis from position: 42
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/ojl2M
function name:  (null)
number of ops:  49
compiled vars:  !0 = $geo, !1 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'New+york%2C+Ny%0Acolumbia%2C+sc%0Acharleston%0Awashington%2C+DC%0ABISMARCK%2C+ND'
    7     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
    9     6      > FE_RESET_R                                       $5      !0, ->47
          7    > > FE_FETCH_R                                               $5, !1, ->47
   12     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%2C'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
   16    13        ISSET_ISEMPTY_DIM_OBJ                         1  ~8      !1, 0
         14        BOOL_NOT                                         ~9      ~8
         15      > JMPZ                                                     ~9, ->28
         16    >   INIT_FCALL                                               'ucwords'
         17        INIT_FCALL                                               'strtolower'
         18        INIT_FCALL                                               'trim'
         19        FETCH_DIM_R                                      ~10     !1, 0
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                         $11     
         22        SEND_VAR                                                 $11
         23        DO_ICALL                                         $12     
         24        SEND_VAR                                                 $12
         25        DO_ICALL                                         $13     
         26        QM_ASSIGN                                        ~14     $13
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~14     null
   17    29    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~15     !1, 1
         30        BOOL_NOT                                         ~16     ~15
         31      > JMPZ                                                     ~16, ->42
         32    >   INIT_FCALL                                               'strtoupper'
         33        INIT_FCALL                                               'trim'
         34        FETCH_DIM_R                                      ~17     !1, 1
         35        SEND_VAL                                                 ~17
         36        DO_ICALL                                         $18     
         37        SEND_VAR                                                 $18
         38        DO_ICALL                                         $19     
         39        CONCAT                                           ~20     '%2C+', $19
         40        QM_ASSIGN                                        ~21     ~20
         41      > JMP                                                      ->43
         42    >   QM_ASSIGN                                        ~21     null
         43    >   CONCAT                                           ~22     ~14, ~21
         44        CONCAT                                           ~23     ~22, '%0A'
         45        ECHO                                                     ~23
    9    46      > JMP                                                      ->7
         47    >   FE_FREE                                                  $5
   18    48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
314.28 ms | 1007 KiB | 18 Q