Page 1 of 1

args = false ???

Posted: Fri Nov 21, 2014 11:03 am
by gautamz07

Code: Select all

		public function world($arg = false){
			echo "We are the world !!" . '<br>';
			echo "Optional: " . $arg . '<br>';
		}
in the above code why $ args==false ?? why not just a normal variable like $temp , any advantage of doing it this way ??

Re: args = false ???

Posted: Fri Nov 21, 2014 11:10 am
by Celauran
Optional arguments require a default value. Could have been null, 12, 'apple'. Doesn't much matter.