3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a($value) { $frequency = (float) $value; return is_nan($frequency) ? null : $frequency; } function b($value) { $frequency = $value; return is_nan($frequency) ? null : (float) $frequency; } function meh($value) { var_dump(a($value) === b($value)); } foreach (array(0, NAN, "asdf", 2.4) as $value) { meh($value); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 6
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/pchku
function name:  (null)
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E > > FE_RESET_R                                       $1      <array>, ->6
          1    > > FE_FETCH_R                                               $1, !0, ->6
   18     2    >   INIT_FCALL                                               'meh'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0          
   17     5      > JMP                                                      ->1
          6    >   FE_FREE                                                  $1
   19     7      > RETURN                                                   1

Function a:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pchku
function name:  a
number of ops:  12
compiled vars:  !0 = $value, !1 = $frequency
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        CAST                                          5  ~2      !0
          2        ASSIGN                                                   !1, ~2
    5     3        INIT_FCALL                                               'is_nan'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $4      
          6      > JMPZ                                                     $4, ->9
          7    >   QM_ASSIGN                                        ~5      null
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~5      !1
         10    > > RETURN                                                   ~5
    6    11*     > RETURN                                                   null

End of function a

Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pchku
function name:  b
number of ops:  12
compiled vars:  !0 = $value, !1 = $frequency
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, !0
   10     2        INIT_FCALL                                               'is_nan'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $3      
          5      > JMPZ                                                     $3, ->8
          6    >   QM_ASSIGN                                        ~4      null
          7      > JMP                                                      ->10
          8    >   CAST                                          5  ~5      !1
          9        QM_ASSIGN                                        ~4      ~5
         10    > > RETURN                                                   ~4
   11    11*     > RETURN                                                   null

End of function b

Function meh:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pchku
function name:  meh
number of ops:  12
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'a'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $1      
          5        INIT_FCALL                                               'b'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8        IS_IDENTICAL                                     ~3      $1, $2
          9        SEND_VAL                                                 ~3
         10        DO_ICALL                                                 
   15    11      > RETURN                                                   null

End of function meh

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.45 ms | 1403 KiB | 20 Q