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
hi all!!
i'm writing functions like -
---
function top () {
echo blah blah blah;}
---
what i want to do is make it so that i can do -
---
function top($image) {
echo blah blah $image blah; }
---
but also make the $image parameter in the top() as optional. so if
its not
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;}
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
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.
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
($someimage);
-Original Message-
From: sunny AT wde [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 24, 2001 9:58 AM
To: php
Subject: [PHP] how do i give optional arguments to functions??
hi all!!
i'm writing functions like -
---
function top () {
echo blah blah blah
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
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
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
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
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)
--
: [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
13 matches
Mail list logo