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',0,'UTF-8').' '.'mb_strpos finds HERE at: '.mb_strpos($a_non_multibyte_str_same_length,'HERE',0,'UTF-8');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CPbNo
function name:  (null)
number of ops:  34
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                                                 0
         20        SEND_VAL                                                 'UTF-8'
         21        DO_ICALL                                         $10     
         22        CONCAT                                           ~11     'mb_strpos+finds+HERE+at%3A+', $10
         23        CONCAT                                           ~12     ~11, '+'
         24        CONCAT                                           ~13     ~12, 'mb_strpos+finds+HERE+at%3A+'
         25        INIT_FCALL                                               'mb_strpos'
         26        SEND_VAR                                                 !1
         27        SEND_VAL                                                 'HERE'
         28        SEND_VAL                                                 0
         29        SEND_VAL                                                 'UTF-8'
         30        DO_ICALL                                         $14     
         31        CONCAT                                           ~15     ~13, $14
         32        ECHO                                                     ~15
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.4 ms | 1396 KiB | 17 Q