3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "foo\x00bar\x00baz"; function showRawCharacters($result) { $resultInHex = unpack('H*', $result); $resultInHex = $resultInHex[1]; $resultSeparated = implode(', ', str_split($resultInHex, 2)); //byte safe echo $resultSeparated."\n"; } showRawCharacters($str1); echo "strcmp = ".strcmp($str1, "foo")."\n"; echo "strcmp = ".strcmp("foo", $str1)."\n"; echo "strlen = ".strlen($str1)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SlIEK
function name:  (null)
number of ops:  23
compiled vars:  !0 = $str1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'foo%00bar%00baz'
   15     1        INIT_FCALL                                               'showrawcharacters'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   18     4        INIT_FCALL                                               'strcmp'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 'foo'
          7        DO_ICALL                                         $3      
          8        CONCAT                                           ~4      'strcmp+%3D+', $3
          9        CONCAT                                           ~5      ~4, '%0A'
         10        ECHO                                                     ~5
   19    11        INIT_FCALL                                               'strcmp'
         12        SEND_VAL                                                 'foo'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        CONCAT                                           ~7      'strcmp+%3D+', $6
         16        CONCAT                                           ~8      ~7, '%0A'
         17        ECHO                                                     ~8
   20    18        STRLEN                                           ~9      !0
         19        CONCAT                                           ~10     'strlen+%3D+', ~9
         20        CONCAT                                           ~11     ~10, '%0A'
         21        ECHO                                                     ~11
         22      > RETURN                                                   1

Function showrawcharacters:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SlIEK
function name:  showRawCharacters
number of ops:  20
compiled vars:  !0 = $result, !1 = $resultInHex, !2 = $resultSeparated
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'unpack'
          2        SEND_VAL                                                 'H%2A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    9     6        FETCH_DIM_R                                      ~5      !1, 1
          7        ASSIGN                                                   !1, ~5
   10     8        INIT_FCALL                                               'implode'
          9        SEND_VAL                                                 '%2C+'
         10        INIT_FCALL                                               'str_split'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 2
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !2, $8
   11    17        CONCAT                                           ~10     !2, '%0A'
         18        ECHO                                                     ~10
   12    19      > RETURN                                                   null

End of function showrawcharacters

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.36 ms | 1402 KiB | 22 Q