3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function b($a, $b = 0) { var_dump($b); } public function c($a, $b = 0) { $b = $b ?: 0; var_dump($b); } } $a = new A(); $a->b(1); $a->b(1, NULL); $a->b(1, 0); $a->b(1, ''); $a->b(1, []); $a->b(1, (object) []); print '----------------' . PHP_EOL; $a->c(1); $a->c(1, NULL); $a->c(1, 0); $a->c(1, ''); $a->c(1, []); $a->c(1, (object) []);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Jmte
function name:  (null)
number of ops:  53
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   NEW                                                  $1      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   14     3        INIT_METHOD_CALL                                             !0, 'b'
          4        SEND_VAL_EX                                                  1
          5        DO_FCALL                                          0          
   15     6        INIT_METHOD_CALL                                             !0, 'b'
          7        SEND_VAL_EX                                                  1
          8        SEND_VAL_EX                                                  null
          9        DO_FCALL                                          0          
   16    10        INIT_METHOD_CALL                                             !0, 'b'
         11        SEND_VAL_EX                                                  1
         12        SEND_VAL_EX                                                  0
         13        DO_FCALL                                          0          
   17    14        INIT_METHOD_CALL                                             !0, 'b'
         15        SEND_VAL_EX                                                  1
         16        SEND_VAL_EX                                                  ''
         17        DO_FCALL                                          0          
   18    18        INIT_METHOD_CALL                                             !0, 'b'
         19        SEND_VAL_EX                                                  1
         20        SEND_VAL_EX                                                  <array>
         21        DO_FCALL                                          0          
   19    22        INIT_METHOD_CALL                                             !0, 'b'
         23        SEND_VAL_EX                                                  1
         24        CAST                                              8  ~9      <array>
         25        SEND_VAL_EX                                                  ~9
         26        DO_FCALL                                          0          
   20    27        ECHO                                                         '----------------%0A'
   21    28        INIT_METHOD_CALL                                             !0, 'c'
         29        SEND_VAL_EX                                                  1
         30        DO_FCALL                                          0          
   22    31        INIT_METHOD_CALL                                             !0, 'c'
         32        SEND_VAL_EX                                                  1
         33        SEND_VAL_EX                                                  null
         34        DO_FCALL                                          0          
   23    35        INIT_METHOD_CALL                                             !0, 'c'
         36        SEND_VAL_EX                                                  1
         37        SEND_VAL_EX                                                  0
         38        DO_FCALL                                          0          
   24    39        INIT_METHOD_CALL                                             !0, 'c'
         40        SEND_VAL_EX                                                  1
         41        SEND_VAL_EX                                                  ''
         42        DO_FCALL                                          0          
   25    43        INIT_METHOD_CALL                                             !0, 'c'
         44        SEND_VAL_EX                                                  1
         45        SEND_VAL_EX                                                  <array>
         46        DO_FCALL                                          0          
   26    47        INIT_METHOD_CALL                                             !0, 'c'
         48        SEND_VAL_EX                                                  1
         49        CAST                                              8  ~16     <array>
         50        SEND_VAL_EX                                                  ~16
         51        DO_FCALL                                          0          
         52      > RETURN                                                       1

Class A:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Jmte
function name:  b
number of ops:  6
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      0
    5     2        INIT_FCALL                                                   'var_dump'
          3        SEND_VAR                                                     !1
          4        DO_ICALL                                                     
    6     5      > RETURN                                                       null

End of function b

Function c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Jmte
function name:  c
number of ops:  9
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      0
    8     2        JMP_SET                                              ~2      !1, ->4
          3        QM_ASSIGN                                            ~2      0
          4        ASSIGN                                                       !1, ~2
    9     5        INIT_FCALL                                                   'var_dump'
          6        SEND_VAR                                                     !1
          7        DO_ICALL                                                     
   10     8      > RETURN                                                       null

End of function c

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.9 ms | 482 KiB | 8 Q