Re: [PHP] how do i give optional arguments to functions??

2001-10-25 Thread Jason G.
Umm... function top($image = '') { echo(bla bla $image bla); } Might need to use an IF (because of having 2 spaces if the image is empty) -Jason Garber IonZoft.com At 10:14 AM 10/24/2001 -0700, Richard S. Crawford wrote: function top ($image) { if ($image) echo blah blah

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Richard S. Crawford
function top ($image) { if ($image) echo blah blah blah; else echo blah blah $image blah; } There's probably a more efficient way to do it. At 09:57 AM 10/24/2001, sunny AT wde wrote: hi all!! i'm writing functions like - --- function top () { echo blah blah blah;}

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Arpad Tamas
On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote: The default value for $image parameter was missing: function top ($image=defaultvalue) { if ($image==defaultvalue) echo blah blah blah; else echo blah blah $image blah; } Arpi -- PHP General Mailing

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Richard S. Crawford
Hm, is the default attribute necessary? I've used this sort of approach without the default attribute just fine in the past. Though I admit that the default attribute would make me feel more secure. At 10:30 AM 10/24/2001, Arpad Tamas wrote: On Wednesday 24 October 2001 19:14, Richard S.

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Tamas Arpad
On Wednesday 24 October 2001 19:26, Richard S. Crawford wrote: Hm, is the default attribute necessary? I've used this sort of approach without the default attribute just fine in the past. Though I admit that the default attribute would make me feel more secure. Not really necessary, but I

RE: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Chris Bailey
Check out the manual section on default parameters... But the basics are: function top($image = null) { if ($image) ... else ... } Or maybe: That will set image to be null, so that you can call top either as: top(); or

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Richard S. Crawford
Ahh, good point. Thanks for the tip. :) At 10:45 AM 10/24/2001, Tamas Arpad wrote: Not really necessary, but I like to make code without any warning message (it also makes the code more cleaner as you said), and you'll get a warning message if there's no parameter given at the function call

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread DL Neil
On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote: The default value for $image parameter was missing: function top ($image=defaultvalue) { if ($image==defaultvalue) echo blah blah blah; else echo blah blah $image blah; } If the default value can be

RE: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Chris Bailey
Tamas; Richard S. Crawford; sunny AT wde; php Subject: Re: [PHP] how do i give optional arguments to functions?? On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote: The default value for $image parameter was missing: function top ($image=defaultvalue) { if ($image

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Mike Frazer
Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 24, 2001 10:41 AM To: Arpad Tamas; Richard S. Crawford; sunny AT wde; php Subject: Re: [PHP] how do i give optional arguments to functions?? On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote: The

Re: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread John A. Grant
Chris Bailey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Check out the manual section on default parameters... But the basics are: function top($image = null) { if ($image) Shouldn't that be: function top($image=null) if ($image) --

RE: [PHP] how do i give optional arguments to functions??

2001-10-24 Thread Chris Bailey
: [PHP] how do i give optional arguments to functions?? Chris Bailey [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Check out the manual section on default parameters... But the basics are: function top($image = null) { if ($image) S