How do i separate the item i added in the array again

Hello,
The code below works fine
I want to add an element to the switch array and again I want to separate the element I added in the for loop
AND
I want the values with the previous minus icon to continue processing

The item I added I want to use in a for loop operation with a variable
Sample:
“18x-08”
“18x-20|13x-16|7x-12|3x-08” as
So what is this?
-xx are products to search for
18,13,7,3 these are the floors where the board is located
I will use it when creating a document showing which product will be used on which floor.
I will be glad if you help

switch($bloktaki_pano_sayisi){
        case $bloktaki_pano_sayisi == 2 : $hedefsecenek = array(
        "-08"); break;
        case $bloktaki_pano_sayisi == 3 : $hedefsecenek = array(
        "-08|-12"); break;
        case $bloktaki_pano_sayisi == 4 : $hedefsecenek = array(
        "-08|-12|-16"); break;
        case $bloktaki_pano_sayisi == 5 : $hedefsecenek = array(
        "-08|-12|-16|-20"); break;
}

    for ($vi = 0; $vi < count($hedefsecenek); $vi++) {
    $hsecs = explode("|", $hedefsecenek[$vi]);
    $hsecsay = count($hsecs);

// I want to protect the keys when the code operates according to the key
// Part of code working with sample key
if ($hsecsay == 4){
    $var4kaskad0 = array_search($hsecs[0], $kaskadarray);
    $var4kaskad1 = array_search($hsecs[1], $kaskadarray);
    $var4kaskad2 = array_search($hsecs[2], $kaskadarray);
    $var4kaskad3 = array_search($hsecs[3], $kaskadarray);
}
}

Well, Adem, nobody really uses concatenated values for searches. Normally, you might display them concatenated, but, the live data would be in the database separately. In that way you can search in any way you want to.

So, 18-08, 18-20, 3-08, etc would be saved in the database as…

data1    data2
18          8
18          20
 3          08

And, then to display it, you echo $data1 . “-” . $data2 (Concatenate the two data’s with a dash between)

But, if you must do it your way, when you create the field, you could add hidden fields with the options in them. Meaning if you have 18-08, you can split it using the “EXPLODE” function which will get the 18 and the 8 by themselves. And, with those split up, you can create a hidden <input with the value for furture uses. But, again, this is not the best way to do it.

The product to search is “-08”, “-12”…, so it has to be hyphen.
minus character means how much the signal will be attenuated
This is how I solved it

First I smashed it with a vertical line

for ($vi = 0; $vi < count($hedefsecenek); $vi++) {

    $kat_tap = explode("|", $hedefsecenek[$vi]); // first i smashed from the vertical line
    $hsecsay = count($kat_tap);

    $taplarin_kati = [];
    $hsecs = [];
    foreach($kat_tap AS $kattap){
        $kattapayir = explode("x",$kattap); //then i split it from x
        $taplarin_kati[] = $kattapayir[0]; // I created the floors separately 18,13,7,3 as
        $hsecs[] = $kattapayir[1]; // for products to be searched, -20,-16,-12,-08 as
    }
}

Product search worked Matching floors I haven’t tried yet
I have a little problem I’m trying to fix it
If there are 4 boards in the block
If the number of optics is 4
The product here is not needed, as each board goes optical
But it gives the remaining product from the previous cycle
I’m trying to fix this

Thank you

Sponsor our Newsletter | Privacy Policy | Terms of Service