[wp-hackers] Hooks, Actions, Filters
    Jeremy Visser 
    jeremy at visser.name
       
    Thu Jul 30 06:45:02 UTC 2009
    
    
  
On Thu, 2009-07-30 at 07:50 +0200, Bruno Alexandre wrote:
> where and how do I know what to expect from that? And what about if I was
> expecting $id (page id)... I don't get where this variable appears from thin
> air :-(
Not sure I completely understand your question, but in a function, you
can name the parameters whatever you want. The following functions would
all work identically:
       function remove_protected_title_format($tom) {
               return str_replace('Protected: ', '', $tom);
       }
       function remove_protected_title_format($dick) {
               return str_replace('Protected: ', '', $dick);
       }
       function remove_protected_title_format($harry) {
               return str_replace('Protected: ', '', $harry);
       }
Because when you call it, all you do is pass the parameter, not the name
of it:
	remove_protected_title_format('the argument');
Notice how I didn't need to specify the variable name (tom, dick, or
harry). You don't need to do this for example (and this is invalid):
	remove_protected_title_format($s = 'the argument');
Hope I've clarified things.
    
    
More information about the wp-hackers
mailing list