General Community > Scripting Help
calling functions
Saleh:
if I had a function inside a function , e.g.
<?php
function what_eva() {
function what_tha() {
echo'yet another stupid quiestion';
}
[other statments]
}
?>
can I call what_tha() with out calling what_eva() ?
Overseer:
can u even legally do that in php?
Shadow:
I don't believe so. In fact I'm not sure if that works well if at all. I suggest putting it outside of the function. Because you can still do this...
<?php
function what_eva() {
what_tha();
}
?>
And it'll work fine.
Parham:
not at home so i can't test this... i THINK it's legal, but generally useless to do something like that. It's also very very weird, how would scope work? I mean in php you have the global scope, and the local scope (functions n' stuff)... what would the above code mean? local local scope, or is the outter function considered the global scope?
[Unknown]:
It's legal. It can be used to logically group functions. However, the function is defined no matter what in my experience, although it may just be when the function is called.
But yes, it's legal.
-[Unknown]
Navigation
[0] Message Index
[#] Next page
Go to full version