| | #1 |
| Call Center Services Join Date: 2010 Location: Philippines
Posts: 146
Thanks: 3
Thanked 9 Times in 9 Posts
|
How do I set default value of function parameter as today's date? I tried: function funcName($today=date('Y-m-d')) {do something} Throws me this error: Parse error: syntax error, unexpected '(', expecting ')' Thanks. |
|
For your call center needs: Call Center Philippines BPO Services Philippines Philippines Call Center | |
| |
| | #2 |
| HyperActive Warrior War Room Member Join Date: 2010 Location: Tokyo
Posts: 314
Thanks: 27
Thanked 43 Times in 42 Posts
|
try: function funcName($today=false) { if(!$today){ $today = date('Y-m-d'); } //do something } |
|
"Jamroom is a Profile Centric CMS system suitable as a development framework for building entire communities. Highly modular in concept. Suitable for enterprise level development teams or solo freelancers." | |
| |
| | #3 |
| Warrior Member Join Date: 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
Just checking. Is this PHP?
|
| |
| | #4 |
| Warrior Member Join Date: 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
Is this PHP?
|
| |
| | #5 |
| VIP Warrior War Room Member Join Date: 2006 Location: , , USA.
Posts: 1,795
Thanks: 70
Thanked 287 Times in 259 Posts
|
If this is for PHP try: define('TODAY', date('Y-m-d')); function funcName($today=TODAY); |
| |
|
| Bookmarks |
| Tags |
| date, default, function, parameter, set, today |
| |