Jump to content

Function Overloading


JustinK101

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.