3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_field($field, $post_id, $format = true) { return ['project_manager' => 2, 'contractor' => 1][$field] ?? null; } function update_field($field, $payload, $post_id, $format = true) { var_export($payload); } function my_acf_save_post_31($post_id) { update_field( 'project_user_select', array_filter([ get_field('project_manager', $post_id, false), get_field('architect', $post_id, false), get_field('contractor', $post_id, false) ]), $post_id ); } my_acf_save_post_31(1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s2JDp
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'my_acf_save_post_31'
          1        SEND_VAL                                                 1
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function get_field:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s2JDp
function name:  get_field
number of ops:  8
compiled vars:  !0 = $field, !1 = $post_id, !2 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <true>
    4     3        FETCH_DIM_IS                                     ~3      <array>, !0
          4        COALESCE                                         ~4      ~3
          5        QM_ASSIGN                                        ~4      null
          6      > RETURN                                                   ~4
    5     7*     > RETURN                                                   null

End of function get_field

Function update_field:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s2JDp
function name:  update_field
number of ops:  8
compiled vars:  !0 = $field, !1 = $payload, !2 = $post_id, !3 = $format
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV_INIT                                        !3      <true>
    8     4        INIT_FCALL                                               'var_export'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
    9     7      > RETURN                                                   null

End of function update_field

Function my_acf_save_post_31:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s2JDp
function name:  my_acf_save_post_31
number of ops:  28
compiled vars:  !0 = $post_id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'update_field'
   13     2        SEND_VAL                                                 'project_user_select'
   14     3        INIT_FCALL                                               'array_filter'
   15     4        INIT_FCALL                                               'get_field'
          5        SEND_VAL                                                 'project_manager'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 <false>
          8        DO_FCALL                                      0  $1      
          9        INIT_ARRAY                                       ~2      $1
   16    10        INIT_FCALL                                               'get_field'
         11        SEND_VAL                                                 'architect'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 <false>
         14        DO_FCALL                                      0  $3      
         15        ADD_ARRAY_ELEMENT                                ~2      $3
   17    16        INIT_FCALL                                               'get_field'
         17        SEND_VAL                                                 'contractor'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 <false>
         20        DO_FCALL                                      0  $4      
         21        ADD_ARRAY_ELEMENT                                ~2      $4
         22        SEND_VAL                                                 ~2
   14    23        DO_ICALL                                         $5      
   17    24        SEND_VAR                                                 $5
   19    25        SEND_VAR                                                 !0
   12    26        DO_FCALL                                      0          
   21    27      > RETURN                                                   null

End of function my_acf_save_post_31

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.17 ms | 1013 KiB | 20 Q