3v4l.org

run code in 500+ PHP versions simultaneously
<?php function is_palindrome(string $str): bool { return $str === implode('', array_reverse(grapheme_str_split($str))); } $palindrome = 'satanoscillatemymetallicsonatas'; $polar_bear = "\u{1f43b}\u{200d}\u{2744}\u{fe0f}"; $palindrome = str_replace('y', $polar_bear, $palindrome); echo "$palindrome is" . (is_palindrome($palindrome) ? "" : " not") . " a palindrome";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuVIl
function name:  (null)
number of ops:  18
compiled vars:  !0 = $palindrome, !1 = $polar_bear
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, 'satanoscillatemymetallicsonatas'
    8     1        ASSIGN                                                       !1, '%F0%9F%90%BB%E2%80%8D%E2%9D%84%EF%B8%8F'
    9     2        FRAMELESS_ICALL_3                str_replace         ~4      'y', !1
          3        OP_DATA                                                      !0
          4        ASSIGN                                                       !0, ~4
   10     5        NOP                                                          
          6        FAST_CONCAT                                          ~6      !0, '+is'
          7        INIT_FCALL                                                   'is_palindrome'
          8        SEND_VAR                                                     !0
          9        DO_FCALL                                          0  $7      
         10      > JMPZ                                                         $7, ->13
         11    >   QM_ASSIGN                                            ~8      ''
         12      > JMP                                                          ->14
         13    >   QM_ASSIGN                                            ~8      '+not'
         14    >   CONCAT                                               ~9      ~6, ~8
         15        CONCAT                                               ~10     ~9, '+a+palindrome'
         16        ECHO                                                         ~10
         17      > RETURN                                                       1

Function is_palindrome:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuVIl
function name:  is_palindrome
number of ops:  13
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'array_reverse'
          2        INIT_FCALL_BY_NAME                                           'grapheme_str_split'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0  $1      
          5        SEND_VAR                                                     $1
          6        DO_ICALL                                             $2      
          7        FRAMELESS_ICALL_2                implode             ~3      '', $2
          8        IS_IDENTICAL                                         ~4      !0, ~3
          9        VERIFY_RETURN_TYPE                                           ~4
         10      > RETURN                                                       ~4
    5    11*       VERIFY_RETURN_TYPE                                           
         12*     > RETURN                                                       null

End of function is_palindrome

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.07 ms | 1567 KiB | 15 Q