Ich habe $arrLevel
von lopping Ergebnis:Loop Through Offset in PHP
Array
(
[0] => Array
(
[ohp_id] => 98
[parent_ohp_id] => 84
[organization_id] => 122
[position_id] => 32
[level] => 3
[seat] => 1
[description] =>
[start_date] => 2016-07-21
[end_date] =>
[title] => Coordinator Of Support Operational and Mainte
)
)
Array
(
[0] => Array
(
[ohp_id] => 84
[parent_ohp_id] =>
[organization_id] => 122
[position_id] => 2
[level] => 2
[seat] => 1
[description] =>
[start_date] => 2016-07-21
[end_date] =>
[title] => Chief
)
)
etc...
Einer von ihnen null parent_ohp_id
hat, und in meinem Code gibt es Fehler Notice: Undefined offset: 1
. dies ist mein Code:
for ($i = 0; $i < count($arrPosition); $i++) {
$hasPosition->loadHas($orgId, $arrPosition[$i]);
$level = search($arr, 'level', $arrLevel[$i]);
//print_r($level);
if(isset($level[$i]['parent_ohp_id'])){
if((int)$level[$i]['parent_ohp_id'] == (int)$level[$i]['ohp_id']){
$parentOhp = null;
}
else{
$parentOhp = $level[$i]['parent_ohp_id'];
}
}
else{
$parentOhp = null;
}
etc...
Ursache, die Loop-Prozess stoppen und alle Array versetzt, nachdem es nicht zeigen kann/können Looping nicht fortgesetzt werden. wie man es repariert und einen undefinierten Offset parent_ohp_id
auf null
setzt? Dank ...
ersetzen kann Fehler behoben ist, aber immer noch nicht –