I intend to run only once the “p” element, I don’t know why the value passed after it has ran is not updated in the above variable and hence not run again i.e is running always with the “not done” value. Thought it was a problem witch scope so tried global but didn’t make any difference… I do know I should use a boolean, but I wanted to be sure why it wasn’t working first.
$new_loop = array_slice($new_loop, $offset, $posts_per_page);
$separador_enviado = "not done";
$loop_counter = "";
foreach ($new_loop as $loop) {
if($separador_enviado == "not done") {
?>
<p>This should be outputed only once</p>
<?php
global $separador_enviado;
$separador_enviado = "done";
}
else { ?>
<p> item in the loop not running </p> <?php
}
$loop_counter++;
}
Do note this is a simplified version of the original code…