Answer the question
In order to leave comments, you need to log in
Problem with foreach. Why is it throwing a 504 error?
Hello. Tell me please, who can come across ...
In general, the situation is this. There is a two-dimensional array $a. It contains arrays with data (65 arrays). These data are relatively few, about 15 key => value pairs, the maximum value, well, maybe 100 characters
. I need to add some fields, some to change.
I do it like this:
$c=array();
foreach($a as $b){
//ну например увеличим цену на 2
$temp['Price']=$b['Price']*2;
//добавим например контрольную сумму
$temp['crc']=md5($b['name'].$b['Price'].$b['id']);
$c[]=$temp;
}
echo json_encode($c);
Answer the question
In order to leave comments, you need to log in
On hosting, what is the limit for the script to work 30 seconds? Probably doesn't make it.
put a microtime on each foreach element and display it on the screen, you will see how much each element is processed - you can draw conclusions.
Although the steps here are so simple... try putting it in a separate script not tied to Codeigniter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question