3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump([ 'compared to empty' => [ "strcmp('', 'a')" => strcmp('', 'a'), "strcmp('', str_repeat('a', 2))" => strcmp('', str_repeat('a', 2)), "strcmp('', str_repeat('a', 8))" => strcmp('', str_repeat('a', 8)), ], 'same leading substring (no mismatch, but unequal length' => [ "strcmp('a', str_repeat('a', 2))" => strcmp('a', str_repeat('a', 2)), "strcmp('a', str_repeat('a', 8))" => strcmp('a', str_repeat('a', 8)), "strcmp('aaa', str_repeat('aaa', 2))" => strcmp('aaa', str_repeat('aaa', 2)), "strcmp('aaa', str_repeat('aaa', 8))" => strcmp('aaa', str_repeat('aaa', 8)), "strcmp('aaa', str_repeat('aaa', 20))" => strcmp('aaa', str_repeat('aaa', 20)), ], 'equal length parial match' => [ "strcmp('a', 'z')" => strcmp('a', 'z'), "strcmp('aaaa', 'aaaz')" => strcmp('aaaa', 'aaaz'), "strcmp('aaaaaa', 'aaazaa')" => strcmp('aaaaaa', 'aaazaa'), "strcmp('aaaaaa', 'aaazzz')" => strcmp('aaaaaa', 'aaazzz'), "strcmp(str_repeat('a', 16), str_repeat('a', 8) . str_repeat('z', 8))" => strcmp(str_repeat('a', 16), str_repeat('a', 8) . str_repeat('z', 8)), ], 'unequal length partial match' => [ "strcmp('a', 'za')" => strcmp('a', 'za'), "strcmp('a', 'az')" => strcmp('a', 'az'), "strcmp('aaa', 'aaza')" => strcmp('aaa', 'aaza'), "strcmp('aaa', 'aazz')" => strcmp('aaa', 'aazz'), "strcmp('aaa', 'az')" => strcmp('aaa', 'az'), "strcmp(str_repeat('a', 7), str_repeat('a', 7) . str_repeat('z', 7))" => strcmp(str_repeat('a', 7), str_repeat('a', 7) . str_repeat('z', 7)), ], 'equal length, no match' => [ "strcmp('a', 'z')" => strcmp('a', 'z'), "strcmp('aaa', 'zaa')" => strcmp('aaa', 'zaa'), "strcmp('aaa', 'zzz')" => strcmp('aaa', 'zzz'), "strcmp(str_repeat('a', 8), 'z' . str_repeat('a', 7))" => strcmp(str_repeat('a', 8), 'z' . str_repeat('a', 7)), "strcmp(str_repeat('a', 8), str_repeat('z', 8))" => strcmp(str_repeat('a', 8), str_repeat('z', 8)), ], 'unequal length, no match' => [ "strcmp('a', 'za')" => strcmp('a', 'za'), "strcmp('aaa', 'zaaaa')" => strcmp('aaa', 'zaaaa'), "strcmp('aaa', 'zzzzz')" => strcmp('aaa', 'zzzzz'), "strcmp(str_repeat('a', 8), 'z' . str_repeat('a', 8))" => strcmp(str_repeat('a', 8), 'z' . str_repeat('a', 8)), "strcmp(str_repeat('a', 8), str_repeat('z', 10))" => strcmp(str_repeat('a', 8), str_repeat('z', 10)), ] ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FN86s
function name:  (null)
number of ops:  243
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
    5     1        INIT_FCALL                                               'strcmp'
          2        SEND_VAL                                                 ''
          3        SEND_VAL                                                 'a'
          4        DO_ICALL                                         $0      
          5        INIT_ARRAY                                       ~1      $0, 'strcmp%28%27%27%2C+%27a%27%29'
    6     6        INIT_FCALL                                               'strcmp'
          7        SEND_VAL                                                 ''
          8        INIT_FCALL                                               'str_repeat'
          9        SEND_VAL                                                 'a'
         10        SEND_VAL                                                 2
         11        DO_ICALL                                         $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                         $3      
         14        ADD_ARRAY_ELEMENT                                ~1      $3, 'strcmp%28%27%27%2C+str_repeat%28%27a%27%2C+2%29%29'
    7    15        INIT_FCALL                                               'strcmp'
         16        SEND_VAL                                                 ''
         17        INIT_FCALL                                               'str_repeat'
         18        SEND_VAL                                                 'a'
         19        SEND_VAL                                                 8
         20        DO_ICALL                                         $4      
         21        SEND_VAR                                                 $4
         22        DO_ICALL                                         $5      
         23        ADD_ARRAY_ELEMENT                                ~1      $5, 'strcmp%28%27%27%2C+str_repeat%28%27a%27%2C+8%29%29'
         24        INIT_ARRAY                                       ~6      ~1, 'compared+to+empty'
   10    25        INIT_FCALL                                               'strcmp'
         26        SEND_VAL                                                 'a'
         27        INIT_FCALL                                               'str_repeat'
         28        SEND_VAL                                                 'a'
         29        SEND_VAL                                                 2
         30        DO_ICALL                                         $7      
         31        SEND_VAR                                                 $7
         32        DO_ICALL                                         $8      
         33        INIT_ARRAY                                       ~9      $8, 'strcmp%28%27a%27%2C+str_repeat%28%27a%27%2C+2%29%29'
   11    34        INIT_FCALL                                               'strcmp'
         35        SEND_VAL                                                 'a'
         36        INIT_FCALL                                               'str_repeat'
         37        SEND_VAL                                                 'a'
         38        SEND_VAL                                                 8
         39        DO_ICALL                                         $10     
         40        SEND_VAR                                                 $10
         41        DO_ICALL                                         $11     
         42        ADD_ARRAY_ELEMENT                                ~9      $11, 'strcmp%28%27a%27%2C+str_repeat%28%27a%27%2C+8%29%29'
   12    43        INIT_FCALL                                               'strcmp'
         44        SEND_VAL                                                 'aaa'
         45        INIT_FCALL                                               'str_repeat'
         46        SEND_VAL                                                 'aaa'
         47        SEND_VAL                                                 2
         48        DO_ICALL                                         $12     
         49        SEND_VAR                                                 $12
         50        DO_ICALL                                         $13     
         51        ADD_ARRAY_ELEMENT                                ~9      $13, 'strcmp%28%27aaa%27%2C+str_repeat%28%27aaa%27%2C+2%29%29'
   13    52        INIT_FCALL                                               'strcmp'
         53        SEND_VAL                                                 'aaa'
         54        INIT_FCALL                                               'str_repeat'
         55        SEND_VAL                                                 'aaa'
         56        SEND_VAL                                                 8
         57        DO_ICALL                                         $14     
         58        SEND_VAR                                                 $14
         59        DO_ICALL                                         $15     
         60        ADD_ARRAY_ELEMENT                                ~9      $15, 'strcmp%28%27aaa%27%2C+str_repeat%28%27aaa%27%2C+8%29%29'
   14    61        INIT_FCALL                                               'strcmp'
         62        SEND_VAL                                                 'aaa'
         63        INIT_FCALL                                               'str_repeat'
         64        SEND_VAL                                                 'aaa'
         65        SEND_VAL                                                 20
         66        DO_ICALL                                         $16     
         67        SEND_VAR                                                 $16
         68        DO_ICALL                                         $17     
         69        ADD_ARRAY_ELEMENT                                ~9      $17, 'strcmp%28%27aaa%27%2C+str_repeat%28%27aaa%27%2C+20%29%29'
         70        ADD_ARRAY_ELEMENT                                ~6      ~9, 'same+leading+substring+%28no+mismatch%2C+but+unequal+length'
   17    71        INIT_FCALL                                               'strcmp'
         72        SEND_VAL                                                 'a'
         73        SEND_VAL                                                 'z'
         74        DO_ICALL                                         $18     
         75        INIT_ARRAY                                       ~19     $18, 'strcmp%28%27a%27%2C+%27z%27%29'
   18    76        INIT_FCALL                                               'strcmp'
         77        SEND_VAL                                                 'aaaa'
         78        SEND_VAL                                                 'aaaz'
         79        DO_ICALL                                         $20     
         80        ADD_ARRAY_ELEMENT                                ~19     $20, 'strcmp%28%27aaaa%27%2C+%27aaaz%27%29'
   19    81        INIT_FCALL                                               'strcmp'
         82        SEND_VAL                                                 'aaaaaa'
         83        SEND_VAL                                                 'aaazaa'
         84        DO_ICALL                                         $21     
         85        ADD_ARRAY_ELEMENT                                ~19     $21, 'strcmp%28%27aaaaaa%27%2C+%27aaazaa%27%29'
   20    86        INIT_FCALL                                               'strcmp'
         87        SEND_VAL                                                 'aaaaaa'
         88        SEND_VAL                                                 'aaazzz'
         89        DO_ICALL                                         $22     
         90        ADD_ARRAY_ELEMENT                                ~19     $22, 'strcmp%28%27aaaaaa%27%2C+%27aaazzz%27%29'
   21    91        INIT_FCALL                                               'strcmp'
         92        INIT_FCALL                                               'str_repeat'
         93        SEND_VAL                                                 'a'
         94        SEND_VAL                                                 16
         95        DO_ICALL                                         $23     
         96        SEND_VAR                                                 $23
         97        INIT_FCALL                                               'str_repeat'
         98        SEND_VAL                                                 'a'
         99        SEND_VAL                                                 8
        100        DO_ICALL                                         $24     
        101        INIT_FCALL                                               'str_repeat'
        102        SEND_VAL                                                 'z'
        103        SEND_VAL                                                 8
        104        DO_ICALL                                         $25     
        105        CONCAT                                           ~26     $24, $25
        106        SEND_VAL                                                 ~26
        107        DO_ICALL                                         $27     
        108        ADD_ARRAY_ELEMENT                                ~19     $27, 'strcmp%28str_repeat%28%27a%27%2C+16%29%2C+str_repeat%28%27a%27%2C+8%29+.+str_repeat%28%27z%27%2C+8%29%29'
        109        ADD_ARRAY_ELEMENT                                ~6      ~19, 'equal+length+parial+match'
   24   110        INIT_FCALL                                               'strcmp'
        111        SEND_VAL                                                 'a'
        112        SEND_VAL                                                 'za'
        113        DO_ICALL                                         $28     
        114        INIT_ARRAY                                       ~29     $28, 'strcmp%28%27a%27%2C+%27za%27%29'
   25   115        INIT_FCALL                                               'strcmp'
        116        SEND_VAL                                                 'a'
        117        SEND_VAL                                                 'az'
        118        DO_ICALL                                         $30     
        119        ADD_ARRAY_ELEMENT                                ~29     $30, 'strcmp%28%27a%27%2C+%27az%27%29'
   26   120        INIT_FCALL                                               'strcmp'
        121        SEND_VAL                                                 'aaa'
        122        SEND_VAL                                                 'aaza'
        123        DO_ICALL                                         $31     
        124        ADD_ARRAY_ELEMENT                                ~29     $31, 'strcmp%28%27aaa%27%2C+%27aaza%27%29'
   27   125        INIT_FCALL                                               'strcmp'
        126        SEND_VAL                                                 'aaa'
        127        SEND_VAL                                                 'aazz'
        128        DO_ICALL                                         $32     
        129        ADD_ARRAY_ELEMENT                                ~29     $32, 'strcmp%28%27aaa%27%2C+%27aazz%27%29'
   28   130        INIT_FCALL                                               'strcmp'
        131        SEND_VAL                                                 'aaa'
        132        SEND_VAL                                                 'az'
        133        DO_ICALL                                         $33     
        134        ADD_ARRAY_ELEMENT                                ~29     $33, 'strcmp%28%27aaa%27%2C+%27az%27%29'
   29   135        INIT_FCALL                                               'strcmp'
        136        INIT_FCALL                                               'str_repeat'
        137        SEND_VAL                                                 'a'
        138        SEND_VAL                                                 7
        139        DO_ICALL                                         $34     
        140        SEND_VAR                                                 $34
        141        INIT_FCALL                                               'str_repeat'
        142        SEND_VAL                                                 'a'
        143        SEND_VAL                                                 7
        144        DO_ICALL                                         $35     
        145        INIT_FCALL                                               'str_repeat'
        146        SEND_VAL                                                 'z'
        147        SEND_VAL                                                 7
        148        DO_ICALL                                         $36     
        149        CONCAT                                           ~37     $35, $36
        150        SEND_VAL                                                 ~37
        151        DO_ICALL                                         $38     
        152        ADD_ARRAY_ELEMENT                                ~29     $38, 'strcmp%28str_repeat%28%27a%27%2C+7%29%2C+str_repeat%28%27a%27%2C+7%29+.+str_repeat%28%27z%27%2C+7%29%29'
        153        ADD_ARRAY_ELEMENT                                ~6      ~29, 'unequal+length+partial+match'
   32   154        INIT_FCALL                                               'strcmp'
        155        SEND_VAL                                                 'a'
        156        SEND_VAL                                                 'z'
        157        DO_ICALL                                         $39     
        158        INIT_ARRAY                                       ~40     $39, 'strcmp%28%27a%27%2C+%27z%27%29'
   33   159        INIT_FCALL                                               'strcmp'
        160        SEND_VAL                                                 'aaa'
        161        SEND_VAL                                                 'zaa'
        162        DO_ICALL                                         $41     
        163        ADD_ARRAY_ELEMENT                                ~40     $41, 'strcmp%28%27aaa%27%2C+%27zaa%27%29'
   34   164        INIT_FCALL                                               'strcmp'
        165        SEND_VAL                                                 'aaa'
        166        SEND_VAL                                                 'zzz'
        167        DO_ICALL                                         $42     
        168        ADD_ARRAY_ELEMENT                                ~40     $42, 'strcmp%28%27aaa%27%2C+%27zzz%27%29'
   35   169        INIT_FCALL                                               'strcmp'
        170        INIT_FCALL                                               'str_repeat'
        171        SEND_VAL                                                 'a'
        172        SEND_VAL                                                 8
        173        DO_ICALL                                         $43     
        174        SEND_VAR                                                 $43
        175        INIT_FCALL                                               'str_repeat'
        176        SEND_VAL                                                 'a'
        177        SEND_VAL                                                 7
        178        DO_ICALL                                         $44     
        179        CONCAT                                           ~45     'z', $44
        180        SEND_VAL                                                 ~45
        181        DO_ICALL                                         $46     
        182        ADD_ARRAY_ELEMENT                                ~40     $46, 'strcmp%28str_repeat%28%27a%27%2C+8%29%2C+%27z%27+.+str_repeat%28%27a%27%2C+7%29%29'
   36   183        INIT_FCALL                                               'strcmp'
        184        INIT_FCALL                                               'str_repeat'
        185        SEND_VAL                                                 'a'
        186        SEND_VAL                                                 8
        187        DO_ICALL                                         $47     
        188        SEND_VAR                                                 $47
        189        INIT_FCALL                                               'str_repeat'
        190        SEND_VAL                                                 'z'
        191        SEND_VAL                                                 8
        192        DO_ICALL                                         $48     
        193        SEND_VAR                                                 $48
        194        DO_ICALL                                         $49     
        195        ADD_ARRAY_ELEMENT                                ~40     $49, 'strcmp%28str_repeat%28%27a%27%2C+8%29%2C+str_repeat%28%27z%27%2C+8%29%29'
        196        ADD_ARRAY_ELEMENT                                ~6      ~40, 'equal+length%2C+no+match'
   39   197        INIT_FCALL                                               'strcmp'
        198        SEND_VAL                                                 'a'
        199        SEND_VAL                                                 'za'
        200        DO_ICALL                                         $50     
        201        INIT_ARRAY                                       ~51     $50, 'strcmp%28%27a%27%2C+%27za%27%29'
   40   202        INIT_FCALL                                               'strcmp'
        203        SEND_VAL                                                 'aaa'
        204        SEND_VAL                                                 'zaaaa'
        205        DO_ICALL                                         $52     
        206        ADD_ARRAY_ELEMENT                                ~51     $52, 'strcmp%28%27aaa%27%2C+%27zaaaa%27%29'
   41   207        INIT_FCALL                                               'strcmp'
        208        SEND_VAL                                                 'aaa'
        209        SEND_VAL                                                 'zzzzz'
        210        DO_ICALL                                         $53     
        211        ADD_ARRAY_ELEMENT                                ~51     $53, 'strcmp%28%27aaa%27%2C+%27zzzzz%27%29'
   42   212        INIT_FCALL                                               'strcmp'
        213        INIT_FCALL                                               'str_repeat'
        214        SEND_VAL                                                 'a'
        215        SEND_VAL                                                 8
        216        DO_ICALL                                         $54     
        217        SEND_VAR                                                 $54
        218        INIT_FCALL                                               'str_repeat'
        219        SEND_VAL                                                 'a'
        220        SEND_VAL                                                 8
        221        DO_ICALL                                         $55     
        222        CONCAT                                           ~56     'z', $55
        223        SEND_VAL                                                 ~56
        224        DO_ICALL                                         $57     
        225        ADD_ARRAY_ELEMENT                                ~51     $57, 'strcmp%28str_repeat%28%27a%27%2C+8%29%2C+%27z%27+.+str_repeat%28%27a%27%2C+8%29%29'
   43   226        INIT_FCALL                                               'strcmp'
        227        INIT_FCALL                                               'str_repeat'
        228        SEND_VAL                                                 'a'
        229        SEND_VAL                                                 8
        230        DO_ICALL                                         $58     
        231        SEND_VAR                                                 $58
        232        INIT_FCALL                                               'str_repeat'
        233        SEND_VAL                                                 'z'
        234        SEND_VAL                                                 10
        235        DO_ICALL                                         $59     
        236        SEND_VAR                                                 $59
        237        DO_ICALL                                         $60     
        238        ADD_ARRAY_ELEMENT                                ~51     $60, 'strcmp%28str_repeat%28%27a%27%2C+8%29%2C+str_repeat%28%27z%27%2C+10%29%29'
        239        ADD_ARRAY_ELEMENT                                ~6      ~51, 'unequal+length%2C+no+match'
        240        SEND_VAL                                                 ~6
    3   241        DO_ICALL                                                 
   45   242      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
285.89 ms | 1028 KiB | 16 Q