3v4l.org

run code in 300+ 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 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PuVIl
function name:  (null)
number of ops:  21
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        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 'y'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !0, $4
   10     8        NOP                                                      
          9        FAST_CONCAT                                      ~6      !0, '+is'
         10        INIT_FCALL                                               'is_palindrome'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $7      
         13      > JMPZ                                                     $7, ->16
         14    >   QM_ASSIGN                                        ~8      ''
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~8      '+not'
         17    >   CONCAT                                           ~9      ~6, ~8
         18        CONCAT                                           ~10     ~9, '+a+palindrome'
         19        ECHO                                                     ~10
         20      > 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:  16
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 ''
          3        INIT_FCALL                                               'array_reverse'
          4        INIT_FCALL_BY_NAME                                       'grapheme_str_split'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11        IS_IDENTICAL                                     ~4      !0, $3
         12        VERIFY_RETURN_TYPE                                       ~4
         13      > RETURN                                                   ~4
    5    14*       VERIFY_RETURN_TYPE                                       
         15*     > RETURN                                                   null

End of function is_palindrome

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151 ms | 1011 KiB | 17 Q