3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_wp_version_compatible( $required ) { $wp_version = '6.4.1'; // Strip off any -alpha, -RC, -beta, -src suffixes. list( $version ) = explode( '-', $wp_version ); if ( is_string( $required ) && substr_count( $required, '.' ) > 2 && str_ends_with( $required, '.0' ) ) { wp_trigger_error( __FUNCTION__, "`{$required}` is not a valid WordPress version string.", E_USER_NOTICE ); $required = rtrim( $required, '.0' ); echo $required . "\n"; } return empty( $required ) || version_compare( $version, $required, '>=' ); } echo is_wp_version_compatible('6.4'); echo is_wp_version_compatible('3.0'); echo is_wp_version_compatible('3.0.0'); echo is_wp_version_compatible('6.4.1');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D63Bt
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'is_wp_version_compatible'
          1        SEND_VAL                                                 '6.4'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   24     4        INIT_FCALL                                               'is_wp_version_compatible'
          5        SEND_VAL                                                 '3.0'
          6        DO_FCALL                                      0  $1      
          7        ECHO                                                     $1
   25     8        INIT_FCALL                                               'is_wp_version_compatible'
          9        SEND_VAL                                                 '3.0.0'
         10        DO_FCALL                                      0  $2      
         11        ECHO                                                     $2
   26    12        INIT_FCALL                                               'is_wp_version_compatible'
         13        SEND_VAL                                                 '6.4.1'
         14        DO_FCALL                                      0  $3      
         15        ECHO                                                     $3
         16      > RETURN                                                   1

Function is_wp_version_compatible:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 39
Branch analysis from position: 24
2 jumps found. (Code = 47) Position 1 = 41, Position 2 = 47
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 39
Branch analysis from position: 23
Branch analysis from position: 17
filename:       /in/D63Bt
function name:  is_wp_version_compatible
number of ops:  49
compiled vars:  !0 = $required, !1 = $wp_version, !2 = $version
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, '6.4.1'
    7     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '-'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6        FETCH_LIST_R                                     $5      $4, 0
          7        ASSIGN                                                   !2, $5
          8        FREE                                                     $4
    9     9        TYPE_CHECK                                   64  ~7      !0
         10      > JMPZ_EX                                          ~7      ~7, ->17
         11    >   INIT_FCALL                                               'substr_count'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 '.'
         14        DO_ICALL                                         $8      
         15        IS_SMALLER                                       ~9      2, $8
         16        BOOL                                             ~7      ~9
         17    > > JMPZ_EX                                          ~7      ~7, ->23
         18    >   INIT_FCALL                                               'str_ends_with'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 '.0'
         21        DO_ICALL                                         $10     
         22        BOOL                                             ~7      $10
         23    > > JMPZ                                                     ~7, ->39
   10    24    >   INIT_FCALL_BY_NAME                                       'wp_trigger_error'
   11    25        SEND_VAL_EX                                              'is_wp_version_compatible'
   12    26        ROPE_INIT                                     3  ~12     '%60'
         27        ROPE_ADD                                      1  ~12     ~12, !0
         28        ROPE_END                                      2  ~11     ~12, '%60+is+not+a+valid+WordPress+version+string.'
         29        SEND_VAL_EX                                              ~11
   13    30        SEND_VAL_EX                                              1024
   10    31        DO_FCALL                                      0          
   16    32        INIT_FCALL                                               'rtrim'
         33        SEND_VAR                                                 !0
         34        SEND_VAL                                                 '.0'
         35        DO_ICALL                                         $15     
         36        ASSIGN                                                   !0, $15
   17    37        CONCAT                                           ~17     !0, '%0A'
         38        ECHO                                                     ~17
   20    39    >   ISSET_ISEMPTY_CV                                 ~18     !0
         40      > JMPNZ_EX                                         ~18     ~18, ->47
         41    >   INIT_FCALL                                               'version_compare'
         42        SEND_VAR                                                 !2
         43        SEND_VAR                                                 !0
         44        SEND_VAL                                                 '%3E%3D'
         45        DO_ICALL                                         $19     
         46        BOOL                                             ~18     $19
         47    > > RETURN                                                   ~18
   21    48*     > RETURN                                                   null

End of function is_wp_version_compatible

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.02 ms | 1022 KiB | 22 Q