<?php function getData() { $args = func_get_args(); // returns an array of all passed arguments echo "<pre>";print_r($args); foreach ($args as $key => $singleArg) { echo "arg".($key+1).": $singleArg\n"; } } getData(); /* prints nothing */ getData('PHP'); /* prints arg1: PHP */ getData('PHP', 'Magento', 'Wordpress'); /* prints arg1: PHP arg2: Magento arg3: WordPress */ die("Stop here.."); ?>
No Comments