3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original_multibyte_string = 'țată în HERE'; $a_non_multibyte_str_same_length = '123456789HERE'; // HERE is on 10th (9th element) character echo 'strpos finds HERE at: '.strpos($original_multibyte_string,'HERE').' '.'strpos finds HERE at: '.strpos($a_non_multibyte_str_same_length,'HERE'); // OUTPUTS: strpos finds HERE at: 12 mb_strpos finds HERE at: 9 echo "\n"; // now lets test the multibyte: echo 'mb_strpos finds HERE at: '.mb_strpos($original_multibyte_string,'HERE','UTF-8').' '.'mb_strpos finds HERE at: '.mb_strpos($a_non_multibyte_str_same_length,'HERE','UTF-8');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Pu9rE
function name:  (null)
number of ops:  32
compiled vars:  !0 = $original_multibyte_string, !1 = $a_non_multibyte_str_same_length
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%C8%9Bat%C4%83+%C3%AEn++HERE'
    4     1        ASSIGN                                                   !1, '123456789HERE'
    6     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'HERE'
          5        DO_ICALL                                         $4      
          6        CONCAT                                           ~5      'strpos+finds+HERE+at%3A+', $4
          7        CONCAT                                           ~6      ~5, '+'
          8        CONCAT                                           ~7      ~6, 'strpos+finds+HERE+at%3A+'
          9        INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 'HERE'
         12        DO_ICALL                                         $8      
         13        CONCAT                                           ~9      ~7, $8
         14        ECHO                                                     ~9
   10    15        ECHO                                                     '%0A'
   12    16        INIT_FCALL                                               'mb_strpos'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 'HERE'
         19        SEND_VAL                                                 'UTF-8'
         20        DO_ICALL                                         $10     
         21        CONCAT                                           ~11     'mb_strpos+finds+HERE+at%3A+', $10
         22        CONCAT                                           ~12     ~11, '+'
         23        CONCAT                                           ~13     ~12, 'mb_strpos+finds+HERE+at%3A+'
         24        INIT_FCALL                                               'mb_strpos'
         25        SEND_VAR                                                 !1
         26        SEND_VAL                                                 'HERE'
         27        SEND_VAL                                                 'UTF-8'
         28        DO_ICALL                                         $14     
         29        CONCAT                                           ~15     ~13, $14
         30        ECHO                                                     ~15
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.41 ms | 1396 KiB | 17 Q