ian)
>Twitter: http://twitter.com/m_elensule
>Facebook: http://facebook.com/menelion
>
>-------- Original message
>From: Ashley Sheridan
>To: Ron Piggott
>Date created: , 1:37:59 AM
>Subject: [PHP] Custom function
>
>
> On Mon, 2011-05-02 at 1
From: Ashley Sheridan
To: Ron Piggott
Date created: , 1:37:59 AM
Subject: [PHP] Custom function
On Mon, 2011-05-02 at 18:28 -0400, Ron Piggott wrote:
> On Mon, May 2, 2011 at 3:16 PM, Ron Piggott
> wrote:
>
>
> Is it possible to write a function with an optional flag?
On Mon, 2011-05-02 at 18:28 -0400, Ron Piggott wrote:
> On Mon, May 2, 2011 at 3:16 PM, Ron Piggott
> wrote:
>
>
> Is it possible to write a function with an optional flag? What would the
> syntax look like?
>
> So far I have:
>
> function load_advertisement( $web_page_reference ,
>
On Mon, May 2, 2011 at 3:16 PM, Ron Piggott
wrote:
Is it possible to write a function with an optional flag? What would the
syntax look like?
So far I have:
function load_advertisement( $web_page_reference ,
$web_advertising_sizes_reference ) {
Hi Ron:
I'm not sure what you mean
On Mon, May 2, 2011 at 3:16 PM, Ron Piggott
wrote:
>
> Is it possible to write a function with an optional flag? What would the
> syntax look like?
>
> So far I have:
>
> function load_advertisement( $web_page_reference ,
> $web_advertising_sizes_reference ) {
>
Hi Ron:
I'm not sure what you m
Is it possible to write a function with an optional flag? What would the
syntax look like?
So far I have:
function load_advertisement( $web_page_reference ,
$web_advertising_sizes_reference ) {
Thanks Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
On 16 February 2011 22:04, Paul M Foster wrote:
> On Wed, Feb 16, 2011 at 09:21:20PM +0100, Peter Lind wrote:
>
>> On 16 February 2011 21:00, Dan Schaefer wrote:
>> > In my code, I set the optional parameter to NULL and check for triple
>> equals
>> > "===" or "!==" to see if the variable has bee
On Wed, Feb 16, 2011 at 09:21:20PM +0100, Peter Lind wrote:
> On 16 February 2011 21:00, Dan Schaefer wrote:
> > In my code, I set the optional parameter to NULL and check for triple
> equals
> > "===" or "!==" to see if the variable has been passed with a value. IMO,
> > this is the safest way.
On 16 February 2011 21:45, Adam Richardson wrote:
> On Wed, Feb 16, 2011 at 3:21 PM, Peter Lind wrote:
>
>> On 16 February 2011 21:00, Dan Schaefer wrote:
>> > In my code, I set the optional parameter to NULL and check for triple
>> equals
>> > "===" or "!==" to see if the variable has been pass
On 16 February 2011 21:45, Andre Polykanine wrote:
> Hello Peter,
>
> So is
> func_get_args()
> the unique way?
>
Not really sure what you mean by the unique way. Most things proposed
so far in the thread would be fine for most purposes, I'd say. If you
really need finegrained control, I'd su
On Wed, Feb 16, 2011 at 3:21 PM, Peter Lind wrote:
> On 16 February 2011 21:00, Dan Schaefer wrote:
> > In my code, I set the optional parameter to NULL and check for triple
> equals
> > "===" or "!==" to see if the variable has been passed with a value. IMO,
> > this is the safest way.
> >
> >
From: Peter Lind
To: Dan Schaefer
Date created: , 10:21:20 PM
Subject: [PHP] Custom function
On 16 February 2011 21:00, Dan Schaefer wrote:
> In my code, I set the optional parameter to NULL and check for triple equals
> "===" or "!==" to see if the variable has bee
On 16 February 2011 21:00, Dan Schaefer wrote:
> In my code, I set the optional parameter to NULL and check for triple equals
> "===" or "!==" to see if the variable has been passed with a value. IMO,
> this is the safest way.
>
> function MyFunction($x, $y, $z=NULL) {
> if ($z !== NULL) {
> // Do
In my code, I set the optional parameter to NULL and check for triple equals "===" or "!==" to see
if the variable has been passed with a value. IMO, this is the safest way.
function MyFunction($x, $y, $z=NULL) {
if ($z !== NULL) {
// Do Something
}
}
Dan Schaefer
Web Developer/Systems Analyst
Hi.
On Wednesday 16 Feb 2011 at 00:49 Simon J Welsh wrote:
> As $z is converted to a boolean and exists, that works just the same way as
> !empty(). ---
First I'd like to apologise for handing out bad advice, and second, to thank
Simon and Andre for pointing out my mistake. I'll go back to kee
On 16/02/2011, at 1:21 PM, Mark Kelly wrote:
> In this way almost any value in $z will trigger the conditional code,
> including 0 or an empty string. The exceptions are FALSE and NULL. If you
> explicitly need to react to a NULL value, use is_null() to detect it.
http://nz.php.net/boolean#lan
://facebook.com/menelion
Original message
From: Mark Kelly
To: php-general@lists.php.net
Date created: , 2:21:36 AM
Subject: [PHP] Custom function
Hi.
On Tuesday 15 Feb 2011 at 23:41 Andre Polykanine wrote:
> Give it a default (possible empty) value:
>
> function M
On 16 February 2011 00:21, Mark Kelly wrote:
> Hi.
>
> On Tuesday 15 Feb 2011 at 23:41 Andre Polykanine wrote:
>
>> Give it a default (possible empty) value:
>>
>> function MyFunction($x, $y, $z="") {
>> // function goes here
>> if (!empty($z)) {
>> // The optional parameter is given
>> }
>> }
>
>
Hi.
On Tuesday 15 Feb 2011 at 23:41 Andre Polykanine wrote:
> Give it a default (possible empty) value:
>
> function MyFunction($x, $y, $z="") {
> // function goes here
> if (!empty($z)) {
> // The optional parameter is given
> }
> }
Using an empty string and the empty() function in this way can
n)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
Original message
From: Ron Piggott
To: php-general@lists.php.net
Date created: , 1:32:16 AM
Subject: [PHP] Custom function
Is there a way to make an optional flag in a custom func
> -Original Message-
> From: Shawn McKenzie [mailto:nos...@mckenzies.net]
> Sent: Thursday, November 05, 2009 6:14 AM
> To: Daevid Vincent
> Cc: 'Allen McCabe'; 'PHP General'
> Subject: Re: [PHP] Custom function for inserting value
> -Original Message-
> From: Shawn McKenzie [mailto:nos...@mckenzies.net]
> Sent: Wednesday, November 04, 2009 6:20 AM
> To: Allen McCabe; PHP General
> Subject: Re: [PHP] Custom function for inserting values into MySQL
>
> In your example, I would name my form i
Shawn McKenzie wrote:
Allen McCabe wrote:
Do you see any major hangups or screwups on first glance? And is my fear of
trying this out on my database unfounded? Does this even seem that useful?
in all honesty.. loads of screwups - don't try it out on your database &
ultimately if it isn't re
In your example, I would name my form inputs similar to name
="data[user_id]".
Then you just pass the $_POST['data'] array to your function.
-Shawn
Allen McCabe wrote:
> You raise some good points. I always name my input fields after the
> entity names ( eg. input type="hidden" name ="user_id" v
Allen McCabe wrote:
> Okay friends, I have been wondering about writing a simple function that
> will help me with my MySQL inserting. Not because I need to save time and
> space, but because I wanted to.
>
> I wrote a function for inserting 10 values (I have not been able to come up
> with an ide
I would take a look at some of the frameworks like codeignter to see
how they do things.
But like Davied mentioned a simpler way to handle the passing into the
function would be
Function save($table, $data)
Where data is an array of key value pairs which takes your 22
parameters down to
> Do you see any major hangups or screwups on first glance?
Yes.
There is so much wrong with this I don't even know where to begin...
> This function takes 22 parameters: #1 is the table name,
> #2-21 are the row
> names and the values, and #22 is the "integar string".
Dude. Seriously? TWENTY
Okay friends, I have been wondering about writing a simple function that
will help me with my MySQL inserting. Not because I need to save time and
space, but because I wanted to.
I wrote a function for inserting 10 values (I have not been able to come up
with an idea how to make the number of valu
28 matches
Mail list logo