3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test{ const AB♥ = "alphabet"; } $rc = new ReflectionClass("Test"); $const = array_keys( $rc->getConstants())[0]; // $substr = substr( $const, -1,1 ); $substr = mb_substr( $const, -1,1 ); // PHP 5.6 if ( $substr === "♥" ) { trigger_error("\"♥\" in \"$const\"", E_USER_ERROR ); } // Notice: "♥" in "AB ♥" …
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/qPuDf
function name:  (null)
number of ops:  27
compiled vars:  !0 = $rc, !1 = $const, !2 = $substr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'Test'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    4     4        INIT_FCALL                                               'array_keys'
          5        INIT_METHOD_CALL                                         !0, 'getConstants'
          6        DO_FCALL                                      0  $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
          9        FETCH_DIM_R                                      ~8      $7, 0
         10        ASSIGN                                                   !1, ~8
    6    11        INIT_FCALL                                               'mb_substr'
         12        SEND_VAR                                                 !1
         13        SEND_VAL                                                 -1
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $10     
         16        ASSIGN                                                   !2, $10
    7    17        IS_IDENTICAL                                             !2, '%E2%99%A5'
         18      > JMPZ                                                     ~12, ->26
    8    19    >   INIT_FCALL                                               'trigger_error'
         20        ROPE_INIT                                     3  ~14     '%22%E2%99%A5%22+in+%22'
         21        ROPE_ADD                                      1  ~14     ~14, !1
         22        ROPE_END                                      2  ~13     ~14, '%22'
         23        SEND_VAL                                                 ~13
         24        SEND_VAL                                                 256
         25        DO_ICALL                                                 
   10    26    > > RETURN                                                   1

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.78 ms | 1395 KiB | 19 Q