3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attendance = array( array( "student_id" => "1", "date" => "2016-04-24" ) ); $students = array( array( "student_id" => "1", "Reason" => "", "date" => "2016-04-24" ), array( "student_id" => "6", "Reason" => "1", "date" => "2016-04-24" ) ); $atts = array(); foreach($attendance as $att) { $atts[] = $att['student_id']; } foreach($students as &$student) { if(in_array($student['student_id'], $atts)) { $student['Reason']='1'; } else { $student['Reason']='0'; } } echo '<pre>',print_r($students,1),'</pre>';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 24
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 9
filename:       /in/b5fce
function name:  (null)
number of ops:  33
compiled vars:  !0 = $attendance, !1 = $students, !2 = $atts, !3 = $att, !4 = $student
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   24     2        ASSIGN                                                   !2, <array>
   25     3      > FE_RESET_R                                       $8      !0, ->9
          4    > > FE_FETCH_R                                               $8, !3, ->9
   27     5    >   FETCH_DIM_R                                      ~10     !3, 'student_id'
          6        ASSIGN_DIM                                               !2
          7        OP_DATA                                                  ~10
   25     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $8
   31    10      > FE_RESET_RW                                      $11     !1, ->24
         11    > > FE_FETCH_RW                                              $11, !4, ->24
   32    12    >   INIT_FCALL                                               'in_array'
         13        FETCH_DIM_R                                      ~12     !4, 'student_id'
         14        SEND_VAL                                                 ~12
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $13     
         17      > JMPZ                                                     $13, ->21
   34    18    >   ASSIGN_DIM                                               !4, 'Reason'
         19        OP_DATA                                                  '1'
         20      > JMP                                                      ->23
   38    21    >   ASSIGN_DIM                                               !4, 'Reason'
         22        OP_DATA                                                  '0'
   31    23    > > JMP                                                      ->11
         24    >   FE_FREE                                                  $11
   41    25        ECHO                                                     '%3Cpre%3E'
         26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !1
         28        SEND_VAL                                                 1
         29        DO_ICALL                                         $16     
         30        ECHO                                                     $16
         31        ECHO                                                     '%3C%2Fpre%3E'
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.58 ms | 1400 KiB | 17 Q