sharing function name as class
Frecuentes
Visto 49 veces
-1
si tengo
class root_parser extends doc_parser {
function xml_parser($filename, &$id)
{
parent::doc_parser($filename)
}
}
in my code and this
in the included file
class doc_parser
{
public function doc_parser( $filename )
{some code here}
}
will this run the function doc_parser or just access the class? because I get Call to undefined function doc_parser() when using var_dump but it shows up in my backtrace
I don't want to run the function, I just want to know Will it run the function or not? and also why does it show up when I backtrace my code,
here is the code I am using for backtrace
array_walk(debug_backtrace(),create_function('$a,$b','print "{$a[\'function\']}()(".basename($a[\'file\']).":{$a[\'line\']}); ";'));
1 Respuestas
0
Check it by renaming the function or the class and see if the code works then. If it does then you know that the naming is the problem.
Respondido 24 ago 12, 01:08
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas php class or haz tu propia pregunta.
not enough information. Put all the necessary code. Where exactly do you call that code? - zerkms
You're missing open and close brackets on the doc_parser method. - ngen
i don't want to call that code i just wonder does it call the function or just access the class if i have just that - Toussant Landowner
@Toussant Landowner: " if i have just that" --- if you literally have solo eso - it's incorrect code, since
parent::
outside of any class method makes no sense. "i just wonder does it call the function or just access the class" --- this phrase makes no sense as well - zerkmsoh i understand what you mean, i edited it, what i mean is that how to use this parent :: part ? will using parent :: (string) in this situation run an function or will it just access the class? I ask this because in this case the class and the function in that class share the same name - Toussant Landowner