3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_send_email($to, $subject, $body, $from_email = '', $from_name = '') { if ($from_email && $from_name) { // Closure instead of globals $f = static function ($phpmailer) use ($from_email, $from_name) { $phpmailer->From = $from_email; $phpmailer->FromName = $from_name; }; // Overwriting default settings remove_action('phpmailer_init', 'my_phpmailer_smtp'); add_action('phpmailer_init', $f); } else { $from_name = 'Info'; $from_email = 'info@domain.com'; } } function my_send_email2($to, $subject, $body, $from_email = '', $from_name = '') { if ($from_email && $from_name) { // Overwriting default settings remove_action('phpmailer_init', 'my_phpmailer_smtp'); // Inline the function add_action( 'phpmailer_init', static function ($phpmailer) use ($from_email, $from_name) { $phpmailer->From = $from_email; $phpmailer->FromName = $from_name; } ); } else { $from_name = 'Info'; $from_email = 'info@domain.com'; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NFAFN
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E > > RETURN                                                   1

Function my_send_email:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/NFAFN
function name:  my_send_email
number of ops:  24
compiled vars:  !0 = $to, !1 = $subject, !2 = $body, !3 = $from_email, !4 = $from_name, !5 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      ''
          4        RECV_INIT                                        !4      ''
    6     5      > JMPZ_EX                                          ~6      !3, ->7
          6    >   BOOL                                             ~6      !4
          7    > > JMPZ                                                     ~6, ->21
    9     8    >   DECLARE_LAMBDA_FUNCTION                          ~7      [0]
          9        BIND_LEXICAL                                             ~7, !3
         10        BIND_LEXICAL                                             ~7, !4
         11        ASSIGN                                                   !5, ~7
   15    12        INIT_FCALL_BY_NAME                                       'remove_action'
         13        SEND_VAL_EX                                              'phpmailer_init'
         14        SEND_VAL_EX                                              'my_phpmailer_smtp'
         15        DO_FCALL                                      0          
   16    16        INIT_FCALL_BY_NAME                                       'add_action'
         17        SEND_VAL_EX                                              'phpmailer_init'
         18        SEND_VAR_EX                                              !5
         19        DO_FCALL                                      0          
    6    20      > JMP                                                      ->23
   19    21    >   ASSIGN                                                   !4, 'Info'
   20    22        ASSIGN                                                   !3, 'info%40domain.com'
   22    23    > > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NFAFN
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $phpmailer, !1 = $from_email, !2 = $from_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   10     3        ASSIGN_OBJ                                               !0, 'From'
          4        OP_DATA                                                  !1
   11     5        ASSIGN_OBJ                                               !0, 'FromName'
          6        OP_DATA                                                  !2
   12     7      > RETURN                                                   null

End of Dynamic Function 0

End of function my_send_email

Function my_send_email2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/NFAFN
function name:  my_send_email2
number of ops:  23
compiled vars:  !0 = $to, !1 = $subject, !2 = $body, !3 = $from_email, !4 = $from_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      ''
          4        RECV_INIT                                        !4      ''
   27     5      > JMPZ_EX                                          ~5      !3, ->7
          6    >   BOOL                                             ~5      !4
          7    > > JMPZ                                                     ~5, ->20
   29     8    >   INIT_FCALL_BY_NAME                                       'remove_action'
          9        SEND_VAL_EX                                              'phpmailer_init'
         10        SEND_VAL_EX                                              'my_phpmailer_smtp'
         11        DO_FCALL                                      0          
   32    12        INIT_FCALL_BY_NAME                                       'add_action'
   33    13        SEND_VAL_EX                                              'phpmailer_init'
   34    14        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         15        BIND_LEXICAL                                             ~7, !3
         16        BIND_LEXICAL                                             ~7, !4
   37    17        SEND_VAL_EX                                              ~7
   32    18        DO_FCALL                                      0          
   27    19      > JMP                                                      ->22
   41    20    >   ASSIGN                                                   !4, 'Info'
   42    21        ASSIGN                                                   !3, 'info%40domain.com'
   44    22    > > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NFAFN
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $phpmailer, !1 = $from_email, !2 = $from_name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
   35     3        ASSIGN_OBJ                                               !0, 'From'
          4        OP_DATA                                                  !1
   36     5        ASSIGN_OBJ                                               !0, 'FromName'
          6        OP_DATA                                                  !2
   37     7      > RETURN                                                   null

End of Dynamic Function 0

End of function my_send_email2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.28 ms | 1004 KiB | 13 Q