[Xapian-devel] PHP Latest

Daniel Ménard Daniel.Menard at Bdsp.tm.fr
Thu Apr 20 15:57:14 BST 2006


Sam Liddicott a écrit :

> register_globals would have been practiced in Ninevah if Jonah had not
> got their in time. I believe the hittites and jebusites practiced
> register_globals.
> The downfall of babylon is similarly attributed - by reliable sources :-)
>
> The more awkward we make it for people who use register_globals the 
> better.

Hum, humour is difficult for someone like me who is not fluent in 
english, and my poor Collins dictionary is falling into decay ;-)
But I got the idea and I agree, of course.
I was not advocating at all for the use of this horror called 
register_globals, just wanted to say that the number of predefined php 
vars depends on it, and that it won't hurt if we use some of their names 
as parameters.

> why?

because the param hides the name of the global excepted if ...

> You can get globals from within a function using the special
> $GLOBALS['globalname'] array (for example) to get hold of the global var
> $globalname, so we can, surely?

... you use $GLOBAL[]

> we can do
>
> function blah($a,$b=NULL) {
>  if (func_get_arg_count()<2) $b=getDefaultArg();
>  if (func_get_arg_count()<3) $c=$a+2;
>
> so for swig generated php we may be OK doing this.

I think that you mean 'func_num_args', not 'func_get_arg_count'.
This is an interesting idea and it is better than testing if ($b==null) 
because it allows to distinguish between 'no argument given' and 'null 
argument was passed'.

best regards,

-- 

Daniel Ménard

Banque de Données Santé Publique
Avenue du Professeur Léon Bernard
35043 Rennes Cédex

Tél. (+33) 2.99.02.29.42
Fax (+33) 2.99.02.26.28
E-mail Daniel.Menard at Bdsp.tm.fr
http://www.bdsp.tm.fr




More information about the Xapian-devel mailing list