3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* The Euro sign--U+20AC--followed by " hi there", in UTF-8. */ $teststr = "\xe2\x82\xac hi there"; /* Split it into individual characters, passing the /u flag to tell PCRE to interpret the string as UTF-8. */ $testchars = preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY); /* Get some output that should be equivalent. */ preg_match_all('/./u', $teststr, $matches); $goodtestchars = $matches[0]; /* The arrays should be the same length. */ print "This should be 1: '".(count($testchars) == count($goodtestchars))."'\n"; /* And the octet count of the first entry should be three for both arrays. */ print 'These both should be three: '; print strlen($testchars[0]).', '.strlen($goodtestchars[0]). "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P11iZ
function name:  (null)
number of ops:  31
compiled vars:  !0 = $teststr, !1 = $testchars, !2 = $matches, !3 = $goodtestchars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, '%E2%82%AC+hi+there'
    8     1        INIT_FCALL                                               'preg_split'
          2        SEND_VAL                                                 '%2F%2Fu'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 -1
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
   11     8        INIT_FCALL                                               'preg_match_all'
          9        SEND_VAL                                                 '%2F.%2Fu'
         10        SEND_VAR                                                 !0
         11        SEND_REF                                                 !2
         12        DO_ICALL                                                 
   12    13        FETCH_DIM_R                                      ~8      !2, 0
         14        ASSIGN                                                   !3, ~8
   15    15        COUNT                                            ~10     !1
   16    16        COUNT                                            ~11     !3
         17        IS_EQUAL                                         ~12     ~10, ~11
         18        CONCAT                                           ~13     'This+should+be+1%3A+%27', ~12
         19        CONCAT                                           ~14     ~13, '%27%0A'
         20        ECHO                                                     ~14
   20    21        ECHO                                                     'These+both+should+be+three%3A+'
   21    22        FETCH_DIM_R                                      ~15     !1, 0
         23        STRLEN                                           ~16     ~15
         24        CONCAT                                           ~17     ~16, '%2C+'
         25        FETCH_DIM_R                                      ~18     !3, 0
         26        STRLEN                                           ~19     ~18
         27        CONCAT                                           ~20     ~17, ~19
   22    28        CONCAT                                           ~21     ~20, '%0A'
         29        ECHO                                                     ~21
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.33 ms | 1395 KiB | 17 Q