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(FATAL, E_USER_ERROR . "\"♥\" in \"$const\"" ); } // Notice: "♥" in "AB ♥" …
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/fnaYU
function name:  (null)
number of ops:  29
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, ->28
    8    19    >   INIT_FCALL                                               'trigger_error'
         20        FETCH_CONSTANT                                   ~13     'FATAL'
         21        SEND_VAL                                                 ~13
         22        ROPE_INIT                                     3  ~15     '%22%E2%99%A5%22+in+%22'
         23        ROPE_ADD                                      1  ~15     ~15, !1
         24        ROPE_END                                      2  ~14     ~15, '%22'
         25        CONCAT                                           ~17     '256', ~14
         26        SEND_VAL                                                 ~17
         27        DO_ICALL                                                 
   10    28    > > RETURN                                                   1

Class Test: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.34 ms | 1387 KiB | 19 Q