lundi 20 février 2017

PHP : Split an Array by conditions

i have array $values and $Tmax= 500:

$values = array (
array (0 => "MONTENVERS"),
array (0 => "HUVEAU"),
array (0 => "PHILOGUI"),
array (0 => "SEGARD CHRISTINE PATRIMOINE"),
array (0 => "STIQUEL"),
array (80 => "LINO"),
array (86 => "MAUBERT"),
array (94 => "GOSSELIN" ),
array (97 => "LIMPA" ),
array (98 => "CASSIERA" ),
array (120 => "LES VIGNES"),
array (123 => "WURTZ"),
array (124 => "ROUSSET-GAILLARD" ),
array (124 => "LEGRAND" ),
array (126 => "SANZ" ),
array (131 => "VIRONNEAU"),
array (133 => "SOCCORO"),
array (136 => "DESNOS"),
array (178 => "BARRIAC"),
array (233 => "MONTALBETTI"),
array (251 => "FOSSET"),
array (264 => "HERY"),
array (350 => "HUVEAU"),
array (352 => "GABSARIC"),
array (471 => "DSR"),
array (573 => "RTAIMATE"),
array (582 => "DEGERMANN"),
array (589 => "PIERVIE"),
array (601 => "BLC"),
array (617 => "SP PATRIMOINE"),
array (3467 => "RESIDENCE ORPEA DES RIVES D'OR"),

);

i want 2 resultat :
sum of values and value <=$tmax (nb off iteration can be between 3 and N)
http://ift.tt/2l0Fpe9
sum of values and value >5$tmax (nb off iteration can be max 3)
http://ift.tt/2l0Fpe9

Example: I have that :
Error result

i want that
OK result




Aucun commentaire:

Enregistrer un commentaire