Login   Register  
PHP Classes
elePHPant
Icontem

Named Parameters

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author  
Picture of Stefan Jibrail Froelich
Name: Stefan Jibrail Froelich is available for providing paid consulting. Contact Stefan Jibrail Froelich .
Packages: 3 Browse all classes by Stefan Jibrail Froelich Browse all classes by
Country: Ghana Ghana - PHP jobs in Ghana
Age: ???
All time rank: 12332 in Ghana Ghana
Week rank: 425 Up2 in Ghana Ghana Equal
Innovation award
Innovation award
Nominee: 1x


  Detailed description   Download .zip .tar.gz  
This class allows callin functions by passing parameters by name.

It can call a given global function or object function by passing parameters to it by their names instead of having to use the declaration parameter order.

The class uses reflection to determine the function parameter names and parses a string with parameters to extract the parameters values to be passed. It assumes default values for missing parameters.

  Classes of Stefan Jibrail Froelich  >  Named Parameters  >  Download .zip .tar.gz  >  Support forum Support forum (2)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Named Parameters
Base name: named-params
Description: Call functions passing parameters by name
Version: 1
PHP version: 5
License: Artistic License
All time users: 486 users
All time rank: 5005
Week users: 1 user
Week rank: 2173 Up
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Language Constructs to assist in the language control View top rated classes


  Innovation Award  
PHP Programming Innovation award nominee
September 2011
Number 9
Currently PHP requires that you pass parameters to functions by the order they are defined.

Often you do not remember the order of those parameters and you need to check the PHP manual to see what is the right order of each parameter.

An alternative solution would be to support named parameters, so the PHP developers could specify the parameters by any order, just by specifying their names.

Currently PHP does not support named parameters but this class provides a solution that emulates that feature using text strings to pass the parameters to a function.

Manuel Lemos

  User ratings  
There are not enough user ratings to display for this class.

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Plain text file namedparams.class.php Class the main class
Accessible without login Plain text file namedparams.examples.php Example examples and tutorial

Download all files: named-params.tar.gz named-params.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.