<?php
$old_array = array(0 => Array(
'id' => 1392,
'name' => 'vhswwindow2',
'probability' => 65
));
$new_array_array = array(0 => Array(
'id' => 1392,
'name' => 'vhswwindow2',
'probability' => 65
));
,
1=> );
$count_old = count($old_arr);
$count_new = count($new_arr);
$return = array();
$return['change'] = array();//what indexes need to be updated
$return['changed'] = false;//whether or not indexes
$return['add'] = false;
$return['delete'] = false;
$return['add_remove'] = array();
$return['diff'] = NULL;
if ($count_old == $count_new) {
$max = $count_old;
} else if ($count_old < $count_new) {
$max = $count_old;
$return['add'] = true;
$return['diff'] = $count_new - $count_old;
} else {
$max = $count_new;
$return['delete'] = true;
$return['diff'] = $count_old - $count_new;
}
for ($i=0; $i<$max ; $i++) {
$record_changed = false;
for($j=0;$j<3;$j++) {
if ($new_arr[$i][$j]!==$old_arr[$i][$map[$j]]) {//false !=
$return['changed'] = true;
$record_changed = true;
}
}
if ($record_changed) {
$return['change'][] = $i;
}
}
if ($return['diff'] &&($return['diff']>0)) {
for ($j=$max;$j<($max+$return['diff']);$j++) {
$return['add_remove'][] = $j;
}
}
print_r($return);
- Output for 5.4.0 - 5.4.32
- Parse error: syntax error, unexpected ' ' (T_STRING), expecting ')' in /in/DecZa on line 4
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
- Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/DecZa on line 4
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_STRING, expecting ')' in /in/DecZa on line 4
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/DecZa on line 4
Process exited with code 255.
preferences:
209.58 ms | 1395 KiB | 123 Q