Eng | Rus
 
Education -> Solutions -> Overloading function in php
 
 
 
Simple Seo Solutions
SEO and Promotion
sites
VoiceNotebook.com
Speech to text for AndroidAndroid speech to text

Overloading function in php

We can not have two functions with the same name in php 5, but we can simulate this behaviour with the default parameter:
function some_function($one_arg, $sec_arg = "some value that never can appear")
{
if($sec_arg == "some value that never can appear")
	{//some code, for example:	 some_function($one_arg,$one_arg);
	}
else
	//another code
} 
© prjsoft.ru