3v4l.org

run code in 300+ PHP versions simultaneously
<?php $read = array("0" => "master/city", "1" => "master/national_holiday", "2" => "master/operator_comments", "3" => "master/sensors" ); $write = array("0" => "master/city", "1" => "master/national_holiday"); $final = []; array_walk($read,function($v,$k) use (&$final,&$write){ if(array_search($v,$write) > -1){ $final[$v] = 'read/write'; } else{ $final[$v] = 'read'; } }); print_r($final);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dE44v
function name:  (null)
number of ops:  14
compiled vars:  !0 = $read, !1 = $write, !2 = $final
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   11     2        ASSIGN                                                   !2, <array>
   12     3        INIT_FCALL                                               'array_walk'
          4        SEND_REF                                                 !0
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FdE44v%3A12%240'
          6        BIND_LEXICAL                                             ~6, !2
          7        BIND_LEXICAL                                             ~6, !1
   19     8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
   20    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FdE44v%3A12%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dE44v
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $v, !1 = $k, !2 = $final, !3 = $write
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   13     4        INIT_FCALL                                               'array_search'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !3
          7        DO_ICALL                                         $4      
          8        IS_SMALLER                                               -1, $4
          9      > JMPZ                                                     ~5, ->13
   14    10    >   ASSIGN_DIM                                               !2, !0
         11        OP_DATA                                                  'read%2Fwrite'
         12      > JMP                                                      ->15
   17    13    >   ASSIGN_DIM                                               !2, !0
         14        OP_DATA                                                  'read'
   19    15    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FdE44v%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.66 ms | 1396 KiB | 19 Q