php - If is in array? -
Actually it is struggling with one:
I have an existing foreach, in which A loop is specific value. But I also have an array in which the values are mixed, which should be taken as a specific function:
Through here I loop and when value 5 and 9 , Then I assume $ datacolvalue and add it to another decimal number as integer at 2 decimal places.
Otherwise, add it as a string, untouched.
$ data_row = array (); $ Count = 1; Forex Currency ($ row-> COLUMN $ Datacolveview) {if ($ count> 4 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; $ count> 10] $ data_row [] = Round (float) $ Datacolvalue, 2); Else $ data_row [] = (string) $ datacolvalue; $ Count ++; } What I want to do, it's the same thing $ data_row [] = round ((float) $ datacolvalue, 2); If the value is in a constant array named $ count of $ array_to_round that looks like this (the values are different each time php runs: array (12,34,56,78) ;
Although I am about to add an advance to the "Other" situation, but I can not get my head around it. What is the answer / loop during a / ?
In short, for every $ Datacol value, if $ is count (& gt; 4) and (& lt; 10) or $ a The rray_to_round array exists in place, such as int and round, otherwise, keep it as a string.
If the value is present in other arrays, then add it as necessary,
I will also store the round value if you plan to use it as a check and a setter.
Comments
Post a Comment