3v4l.org

run code in 300+ PHP versions simultaneously
<?php // note the const declarations -- constants really read-only vars const COMMA = ','; const EMPTY_STR = ""; const NULL_CHAR = "\0"; $delim = '\n'; // note what happens when inserted into doubled-quoted string $data = "1,2,3,$delim,4,5,6,$delim,7,8,9"; echo "\nThe data is:\n\n$data\n\n"; var_dump( EMPTY_STR, NULL_CHAR,strcmp(EMPTY_STR, NULL_CHAR)); // "" != "\0" and "" !== "\0" echo "Is null char empty value? ",empty(NULL_CHAR)? 'true':'false',"\n"; echo "Is zero an empty value? ",empty(0)? 'true':'false',"\n"; $strNumsEtc = str_replace( COMMA, EMPTY_STR, $data); echo "\nResult: $strNumsEtc\n"; $strArr = explode( $delim, $strNumsEtc); var_dump(str_split($strNumsEtc,3)); foreach ($strArr as $str) { echo $str,PHP_EOL; // echo print both shades of echo: echo multiple vars, print one var plus retval } // must add the PHP_EOL since PHP doesn't automatically do this echo PHP_EOL; foreach ($strArr as $str) { print $str; print PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
2 jumps found. (Code = 77) Position 1 = 68, Position 2 = 72
Branch analysis from position: 68
2 jumps found. (Code = 78) Position 1 = 69, Position 2 = 72
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
Branch analysis from position: 72
2 jumps found. (Code = 77) Position 1 = 75, Position 2 = 79
Branch analysis from position: 75
2 jumps found. (Code = 78) Position 1 = 76, Position 2 = 79
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
Branch analysis from position: 72
Branch analysis from position: 40
2 jumps found. (Code = 77) Position 1 = 68, Position 2 = 72
Branch analysis from position: 68
Branch analysis from position: 72
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
Branch analysis from position: 40
filename:       /in/jAnf9
function name:  (null)
number of ops:  81
compiled vars:  !0 = $delim, !1 = $data, !2 = $strNumsEtc, !3 = $strArr, !4 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'COMMA', '%2C'
    4     1        DECLARE_CONST                                            'EMPTY_STR', ''
    5     2        DECLARE_CONST                                            'NULL_CHAR', '%00'
    6     3        ASSIGN                                                   !0, '%5Cn'
    8     4        ROPE_INIT                                     5  ~7      '1%2C2%2C3%2C'
          5        ROPE_ADD                                      1  ~7      ~7, !0
          6        ROPE_ADD                                      2  ~7      ~7, '%2C4%2C5%2C6%2C'
          7        ROPE_ADD                                      3  ~7      ~7, !0
          8        ROPE_END                                      4  ~6      ~7, '%2C7%2C8%2C9'
          9        ASSIGN                                                   !1, ~6
    9    10        ROPE_INIT                                     3  ~12     '%0AThe+data+is%3A%0A%0A'
         11        ROPE_ADD                                      1  ~12     ~12, !1
         12        ROPE_END                                      2  ~11     ~12, '%0A%0A'
         13        ECHO                                                     ~11
   11    14        INIT_FCALL                                               'var_dump'
         15        FETCH_CONSTANT                                   ~14     'EMPTY_STR'
         16        SEND_VAL                                                 ~14
         17        FETCH_CONSTANT                                   ~15     'NULL_CHAR'
         18        SEND_VAL                                                 ~15
         19        INIT_FCALL                                               'strcmp'
         20        FETCH_CONSTANT                                   ~16     'EMPTY_STR'
         21        SEND_VAL                                                 ~16
         22        FETCH_CONSTANT                                   ~17     'NULL_CHAR'
         23        SEND_VAL                                                 ~17
         24        DO_ICALL                                         $18     
         25        SEND_VAR                                                 $18
         26        DO_ICALL                                                 
   13    27        ECHO                                                     'Is+null+char+empty+value%3F+'
         28        FETCH_CONSTANT                                   ~20     'NULL_CHAR'
         29        BOOL_NOT                                         ~21     ~20
         30      > JMPZ                                                     ~21, ->33
         31    >   QM_ASSIGN                                        ~22     'true'
         32      > JMP                                                      ->34
         33    >   QM_ASSIGN                                        ~22     'false'
         34    >   ECHO                                                     ~22
         35        ECHO                                                     '%0A'
   14    36        ECHO                                                     'Is+zero+an+empty+value%3F+'
         37      > JMPZ                                                     <true>, ->40
         38    >   QM_ASSIGN                                        ~23     'true'
         39      > JMP                                                      ->41
         40    >   QM_ASSIGN                                        ~23     'false'
         41    >   ECHO                                                     ~23
         42        ECHO                                                     '%0A'
   16    43        INIT_FCALL                                               'str_replace'
         44        FETCH_CONSTANT                                   ~24     'COMMA'
         45        SEND_VAL                                                 ~24
         46        FETCH_CONSTANT                                   ~25     'EMPTY_STR'
         47        SEND_VAL                                                 ~25
         48        SEND_VAR                                                 !1
         49        DO_ICALL                                         $26     
         50        ASSIGN                                                   !2, $26
   17    51        ROPE_INIT                                     3  ~29     '%0AResult%3A+'
         52        ROPE_ADD                                      1  ~29     ~29, !2
         53        ROPE_END                                      2  ~28     ~29, '%0A'
         54        ECHO                                                     ~28
   18    55        INIT_FCALL                                               'explode'
         56        SEND_VAR                                                 !0
         57        SEND_VAR                                                 !2
         58        DO_ICALL                                         $31     
         59        ASSIGN                                                   !3, $31
   19    60        INIT_FCALL                                               'var_dump'
         61        INIT_FCALL                                               'str_split'
         62        SEND_VAR                                                 !2
         63        SEND_VAL                                                 3
         64        DO_ICALL                                         $33     
         65        SEND_VAR                                                 $33
         66        DO_ICALL                                                 
   20    67      > FE_RESET_R                                       $35     !3, ->72
         68    > > FE_FETCH_R                                               $35, !4, ->72
   21    69    >   ECHO                                                     !4
         70        ECHO                                                     '%0A'
   20    71      > JMP                                                      ->68
         72    >   FE_FREE                                                  $35
   23    73        ECHO                                                     '%0A'
   24    74      > FE_RESET_R                                       $36     !3, ->79
         75    > > FE_FETCH_R                                               $36, !4, ->79
   25    76    >   ECHO                                                     !4
   26    77        ECHO                                                     '%0A'
   24    78      > JMP                                                      ->75
         79    >   FE_FREE                                                  $36
   27    80      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.21 ms | 1404 KiB | 23 Q