<?php
function MySwal($items, $k){
if ($items[$k] != "end") {
//if ($items != "end") {
echo <<<MySWALSTUFF_A
<p> at {$k} : processing {$items[$k]} . next item is {$items[$k+1]}
MySWALSTUFF_A;
//include this later
echo MySwal($items, ($k+1)); //recursive function
} else { //else for if item is !=end
echo "<HR><h3>This is the end, beautiful friend... </h3>";
}//if for item != end ends here :-)
}
MySwal(array('one', 'two', 'end'), 0);