}
for($j=$startCelebIds;$j<=$lastCelebIds;$j++)
{
array_push($urls,‘http://www.nthwall.com/‘.$languages[$langIndex].’/’.$j);
}
}
is there any error …iam trying to push values into array(urls)…but it showing array to string conversion array…
it showing error like allowed memory exhausted but i included <?php ini_set(“memory_limit”,“24M”);?> to allow the memory …but it still showing error allowed memory exhausted…everytime i increased memory every time when it showing error like allowed memory exhausted…but it still showing error…
Why do you have two startmovie ids? You want to loop from the first start id to the first last id, and from the second start id to the second last id?
Does every start id always have a corresponding last id ?
$languages =array(“te”,“hi”);
$startMovieIds = array(8291800001, 9543200001);
$lastMovieIds = array( 8291800100, 9543210000);
$startCelebIds = array( 8912100001, 2345100001);
$lastCelebIds = array(8912112540, 2345110000);
in this i have two languages (te,hi)
8291800001 is te language startId and 8291800100 is te language lastId likewise 8912100001 is first celebId of te language 8912112540 is last celeb id of te language
and in same way for hi language
and in this each language has corresponding Id’s …id’s are different for each language
Ok, now assuming that all arrays are like you posted, it should be something like this:
$languages =array("te","hi");
$startMovieIds = array(8291800001, 9543200001);
$lastMovieIds = array( 8291800100, 9543210000);
$startCelebIds = array( 8912100001, 2345100001);
$lastCelebIds = array(8912112540, 2345110000);
// loop through the language array with foreach
foreach ($languages as $langIndex => $language) {
// loop from start movie id to last movie id for the current language
for ($i=$startMovieIds[$langIndex];$i<=$lastMovieIds[$langIndex];$i++) {
$urls[] = 'http://www.nthwall.com/'.$language.'/'.$i;
}
// loop from stard celeb id to last celeb id for the current language
for ($j=$startCelebIds[$langIndex];$j<=$lastCelebIds[$langIndex];$j++) {
$urls[] = 'http://www.nthwall.com/'.$language.'/'.$j;
}
}
As you can see, I used $urls instead of array_push, because the manual says:
If you use array_push() to add one element to the array it’s better to use $array = because in that way there is no overhead of calling a function.