Tag Archives: loops
How to pause a loop after 2 runs, insert code in between once, then continue loop where it left off?
I currently have a loop of items being shown on a page.
I would like to run the loop twice (output 2 results/items), and THEN insert a banner ONCE right after the 2nd result, and THEN let loop continue from… Continue reading
Gallery with thumbs, too many foreach loops(?) (PHP)
I have problem with gallery in PHP. The gallery has such construction:
<div class="imageElement">
<h3>Item 1 Title</h3>
<p>Item 1 Description</p>
<a href="open/1.jpg" title="open image" class="open"></a>
<img src="big/1-gallery.jpg" class="full" />
<img src="thumb/1-mini.jpg" class="thumbnail" />
</div>
and so on
…
I have three Continue reading
How to remove duplicate values from an array while keeping count of them?
We have an array filled with category names (many of them repeats) and we need to build a two dimensional array that eliminates the repeats on one side of the array, and on the other side of the array has… Continue reading
Getting index from mutli-dimensional array dynamically in PHP
Is there a way to dynamically append “[]” onto a variable representing an array for selecting array elements, e.g. such that $array[][][$element]… is devised dynamically – ? Thanks! Continue reading
Attempting to loop through 2 arrays simultaneously
I am trying to create a before and after image display using mysqli, php and html.
I am pulling the records from the db with mysqli and php, and am trying to view the results in an Unordered List using… Continue reading
Yet another simple php array looping newbie
Sorry I am sure this is easy but I have spent ages trying to solve this simple problem. I have an array called $listOfLinks. When I print_r this is the output:
Array ( [0] => Array ( [LinkID] => …
PHP array loop not breaking
For some reason, using the following means to loop an array resists its break statements and continues to loop recursively to the utmost last element of the array
function loop($target, $array) {
if($this) {
if(!isset($GLOBALS["loop"])) {
$GLOBALS["loop"]+=1;
$GLOBALS["arrayCount"] = count($array, …
Combining strings and numbers in PHP for loop
PHP newbie here
Can anyone please tell me what is wrong with the below syntax. I have a maximum of 4 files – $created_page1, $created_page2 each with a corresponding page title etc and would like to process these in a… Continue reading
Fun project: PHP foreach loop and Scraping
I’m creating a members card that displays a list of members that are scraped from their profile urls and outputs as an image.
The best way to describe what i’m trying to accomplish is to show you:
This is what… Continue reading
PHP Loop do action for each 10, 20, 30 etc
In php i have loop e.g.
for ($i = 0, $i <= 1000, $i++) {
if ($i = 10 || $i == 20 || $i == 30 || $i == 40 || $i == 50 || $i == 60) {
…





