Help with a simple function?
Posted: Thu May 21, 2009 9:35 am
I'm trying to create a function I can use inside a loop to sort information when it reaches a certain point in an array.
This doesn't seem to echo when needed...
Where as this does...
During the loop $data[$j][2] goes from 1 to 144..
Any help for a newcomer to php?
This doesn't seem to echo when needed...
Code: Select all
function yburg(){
$num = intval($data[$j][2]);
if ($num == 5){
echo "The PLU number 5 is a Cheesburger";}
}
for ($j = 0; $j < $count2; $j++) {
yburg();
echo $data[$j][2], $data[$j][3], '<br />';
}
Code: Select all
for ($j = 0; $j < $count2; $j++) {
echo $data[$j][2], $data[$j][3], '<br />';
$num = intval($data[$j][2]);
if ($num == 5){
echo "The PLU number 5 is a Cheesburger"}
}
Any help for a newcomer to php?