PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
This also outputs "hellothere" instead of just setting $bar to the md5 value of the output of foo();. What can I do to fix this problem? =/
Also I can't put all the functions output into one variable which I then return, because I'm using a lot of printf() in my real function.
I'm sorry if I were too vague. My original function is huge, but this is more similar to the kind of stuff I have (...and I need to keep that printf stuff).
<?
function foo() {
$apples = 36;
$trees = 5;
printf('There are %2$s apples in the %1$s trees with %s monkeys and %s bananas.<br />', $apples, $trees);
$bees = 234;
$dogs = 2;
printf("There are %d bees, and %d dogs.", $bees, $dogs);
}
$bar = md5(foo());
echo $bar;
?>
r3negade wrote:I'm sorry if I were too vague. My original function is huge, but this is more similar to the kind of stuff I have (...and I need to keep that printf stuff).
<?
function foo() {
$apples = 36;
$trees = 5;
printf('There are %2$s apples in the %1$s trees with %s monkeys and %s bananas.<br />', $apples, $trees);
$bees = 234;
$dogs = 2;
printf("There are %d bees, and %d dogs.", $bees, $dogs);
}
$bar = md5(foo());
echo $bar;
?>
I made a mistake on my coding idea so he was correcting my coding not yours matey... lol i missed the return function from your foo function mate... lol
Last edited by phphelpme on Mon Nov 22, 2010 5:08 pm, edited 1 time in total.
yes, sorry again... lol thats right. we both missed out the return function for your function foo pal... But his first code was an example only not the actual code he was using. So i asked for an example of his printf function coding to see what this was all about.
I think the hidden field should do the job wont it? what you think?