You are here: iterate through function arguments by reference « PHP Programming Language « IT news, forums, messages
iterate through function arguments by reference

Posted by amygdala on 12/17/84 11:55

Hi again,

Thanks for taking the time again to help me out. Much appreciated. I'm
pretty new to PHP so I'm exploring the possibilities of the language a bit.

Here's my problem:

I would like to iterate through arguments passed to a function, modify them
but still let them hold there original name. To be precise: I want users to
fill in a register form and once submitted, trim() all field values after
being passed to the function register().

Maybe my effort so far will clear it up even more:

// original list of arguments is quite longer
function register( $firstname, $lastname, $birthdate )
{
// loop through all arguments and modify them by reference
// someting like:
foreach( func_get_args() as $key => $value )
{
$key = trim( $val );
}
// echo trimmed argument $firstname
echo $firstname;
}

Is that possible?

Cheers

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация