3v4l.org

run code in 300+ PHP versions simultaneously
<?php function str_contains_old(string $hay, string $needle): bool { return mb_stripos($hay, $needle) !== false; } $str1 = 'Hello world!'; $str2 = 'hello'; var_dump(str_contains_old($str1, $str2)); // gives bool(true) // str_contains var_dump(str_contains($str1, $str2)); // gives bool(false) $str1 = 'Część'; $str2 = 'cZĘŚĆ'; var_dump(str_contains_old($str1, $str2)); // gives bool(true) // str_contains var_dump(str_contains($str1, $str2)); // gives bool(false) $str1 = 'Część'; $str2 = 'czesc'; var_dump(str_contains_old($str1, $str2)); // gives bool(false) // str_contains var_dump(str_contains($str1, $str2)); // gives bool(false)
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lprsk
function name:  (null)
number of ops:  49
compiled vars:  !0 = $str1, !1 = $str2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'Hello+world%21'
    9     1        ASSIGN                                                   !1, 'hello'
   10     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'str_contains_old'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   12     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'str_contains'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   14    16        ASSIGN                                                   !0, 'Cz%C4%99%C5%9B%C4%87'
   15    17        ASSIGN                                                   !1, 'cZ%C4%98%C5%9A%C4%86'
   16    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'str_contains_old'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !1
         22        DO_FCALL                                      0  $10     
         23        SEND_VAR                                                 $10
         24        DO_ICALL                                                 
   18    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'str_contains'
         27        SEND_VAR                                                 !0
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $12     
         30        SEND_VAR                                                 $12
         31        DO_ICALL                                                 
   20    32        ASSIGN                                                   !0, 'Cz%C4%99%C5%9B%C4%87'
   21    33        ASSIGN                                                   !1, 'czesc'
   22    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'str_contains_old'
         36        SEND_VAR                                                 !0
         37        SEND_VAR                                                 !1
         38        DO_FCALL                                      0  $16     
         39        SEND_VAR                                                 $16
         40        DO_ICALL                                                 
   24    41        INIT_FCALL                                               'var_dump'
         42        INIT_FCALL                                               'str_contains'
         43        SEND_VAR                                                 !0
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                         $18     
         46        SEND_VAR                                                 $18
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Function str_contains_old:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lprsk
function name:  str_contains_old
number of ops:  11
compiled vars:  !0 = $hay, !1 = $needle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'mb_stripos'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6        TYPE_CHECK                                  1018  ~3      $2
          7        VERIFY_RETURN_TYPE                                       ~3
          8      > RETURN                                                   ~3
    6     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function str_contains_old

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.31 ms | 1454 KiB | 19 Q