I compare a string from a feed with another variable and echo a corresponding string.
$xml = @simplexml_load_file($feed);
foreach ($xml->entry as $entry) {
$caller = $entry->caller[0];
$message = $entry->message[0];
}
if (($caller == $id) {
echo '$message';
}
I want to echo no more than 5 messages, regardless of the number of ($caller == $id) matches.
$x=1;
while (($caller == $id) && ($x<=5)) {
echo '$x $message';
$x++;
}
That general approach has failed.
I thought maybe I could put the condition in a function and call it a certain number of times but no luck.
function myFunction(){
echo '$message';
}
$x=1;
while($x<=5) {
echo '$x';
myFunction();
$x++;
}
$caller == $id will always return true.. mot understanding what you arr tryin toachieve here.