dimanche 3 octobre 2021

PHP got too many conditions true [duplicate]

I have this code:

$resources = '1 4750115 7680000 200000 4900000 25,2 4751305 7680000 200000 4900000 25,3 4807381 7680000 200000 4900000 25,4 7079712 7680000 200000 7350000 25';

$mq = new QueueJobModel();
$get_plus = $mq->provider->fetchRow ("SELECT proc_type FROM p_queue WHERE player_id='".$fromVillageRow['player_id']."'");
$tempdata1 = $resources;
$tempdata2 = explode(",", $tempdata1);

if($get_plus['proc_type'] = 19){
    $tempdata3 = explode(" ", $tempdata2[0]);
    $iteming = 0;
}

if($get_plus['proc_type'] = 20){
    $tempdata3 = explode(" ", $tempdata2[1]);
    $iteming = 1;
}

if($get_plus['proc_type'] = 21){
    $tempdata3 = explode(" ", $tempdata2[2]);
    $iteming = 2;
}

if($get_plus['proc_type'] = 22){
    $tempdata3 = explode(" ", $tempdata2[3]);
    $iteming = 3;
}

$tempdata4 = $tempdata3[count($tempdata3)-1]+25;
$tempdata5 = str_replace($tempdata2[$iteming], $tempdata3[0]." ".$tempdata3[1]." ".$tempdata3[2]." ".$tempdata3[3]." ".$tempdata3[4]." ".$tempdata4, $tempdata1);

If proc_type = 19 and 20, or all of the conditions come true in the same time, it only gets one item ID, I want to take all of condition true.

If it's any way I want to edit 25 (x4) in resources before comma, maybe any one make to me a simplest explode on resources so I can edit 25 easily.

Aucun commentaire:

Enregistrer un commentaire