<?php
/*
if (isset(static::$attrAccessible)) {
if (is_array(static::$attrAccessible) && count(static::$attrAccessible) > 0) {
$checkArray = array_fill_keys(static::$attrAccessible, 0);
$attributes = array_intersect_key($attributes, $checkArray);
}
} elseif (isset(static::$attrProtected)) {
if (is_array(static::$attrProtected) && count(static::$attrProtected) > 0) {
$checkArray = array_fill_keys(static::$attrProtected, 0);
$attributes = array_diff_key($attributes, $checkArray);
}
}
*/
$attrAccessible = array('name', 'age', 'location');
$attributes = array('id' => 0, 'name' => 'Jacopo', 'age' => 25, 'location' => 'Milan', 'updated_at' => null, 'created_at' => null);
$checkArray = array_fill_keys($attrAccessible, 0);
$purgedArray = array_intersect_key($attributes, $checkArray);
print_r($purgedArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /in/W0W99
function name: (null)
number of ops: 16
compiled vars: !0 = $attrAccessible, !1 = $attributes, !2 = $checkArray, !3 = $purgedArray
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
17 0 E > ASSIGN !0, <array>
18 1 ASSIGN !1, <array>
20 2 INIT_FCALL 'array_fill_keys'
3 SEND_VAR !0
4 SEND_VAL 0
5 DO_ICALL $6
6 ASSIGN !2, $6
21 7 INIT_FCALL 'array_intersect_key'
8 SEND_VAR !1
9 SEND_VAR !2
10 DO_ICALL $8
11 ASSIGN !3, $8
23 12 INIT_FCALL 'print_r'
13 SEND_VAR !3
14 DO_ICALL
15 > RETURN 1
Generated using Vulcan Logic Dumper, using php 8.0.0
preferences:
155.92 ms | 1394 KiB | 19 Q