JustinK101 Posted October 31, 2006 Share Posted October 31, 2006 Can I do something like:function myFun($input1, input2){}function myFun($input1){}I am running PHP 5. Link to comment https://forums.phpfreaks.com/topic/25751-function-overloading/ Share on other sites More sharing options...
trq Posted November 1, 2006 Share Posted November 1, 2006 Nope. You cannot redeclare a function. Link to comment https://forums.phpfreaks.com/topic/25751-function-overloading/#findComment-117609 Share on other sites More sharing options...
JustinK101 Posted November 1, 2006 Author Share Posted November 1, 2006 Humm thats annoying. Ok thanks. Link to comment https://forums.phpfreaks.com/topic/25751-function-overloading/#findComment-117612 Share on other sites More sharing options...
mainewoods Posted November 1, 2006 Share Posted November 1, 2006 you can use default arguments in php which would let you leave off the second argument if you want:http://www.php.net/manual/en/functions.arguments.php#functions.arguments.default[code]<?php function myFun($input1, input2 = 'local area') { return $input1 . ' fun in ' . $input2;}echo myFun('vacation', 'florida');echo myFun('ballpark');?>[/code] Link to comment https://forums.phpfreaks.com/topic/25751-function-overloading/#findComment-117649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.