Hello,
Example resource
$panel_floors =
[
"1" => "18,13,7,3,1", // Block 1 has 5 panels
"2" => "13,7", // Block 2 has 2 panels
"3" => "18,13,7,3", // Block 3 has 4 panels
"4" => "18,13,7,3" // Block 4 has 4 panels
];
$number_of_shafts =
[
"1" => "1",
"2" => "2",
"3" => "1",
"4" => "2"
];
$Cables_in_panel =
[
"1" => "25,30,35,32,18", // There are 5 panels in block 1 and there are 5 groups in the cable, no problem
"2" => "45,38", // There are 2 panels in block 2 and there are 2 groups in the cable, no problem
"3" => "30,28,35,38", // There are 4 panels in block 3 and there are 4 groups in the cable, no problem
"4" => "25" // Yes, here is the problem. Block 4 has 4 panels, but there is a group of cable. this means that the number of cables is equal in all panels. How to tell the foreach loop to treat it as 25,25,25,25?
];
foreach ($Cables_in_panel AS $block => cables){
$cable = explode(",", $cables);
foreach ($cable AS $cable_subscriber){
// the code inside the loop is here
}
}
Is the number of panels in the block equal to the number of cable groups in the block? First it will be checked
If there is unequal block!
Example: number of panels 4, number of cable groups 1
Example: suppose the number of wires is 25, how to tell the foreach loop to operate as 25,25,25,25?
Also, how do we tell the foreach operation by multiplying the wires of the blocks with 2 shafts by 2?
Thank you