Re: [PHP] Function-return-array idea

2008-01-17 Thread Jim Lucas
Jim Lucas wrote: I think this would be an easier/quicker fix for you then requesting that the PHP developers re-write a large portion of the way PHP currently works. Here is the reference that I have been looking for. http://en.wikipedia.org/wiki/Message_passing Jim -- PHP General Mailing

Re: [PHP] Function-return-array idea

2008-01-17 Thread Nathan Nobbe
On Jan 16, 2008 6:32 PM, Stijn Leenknegt <[EMAIL PROTECTED]> wrote: > Hello > > I've an idea for PHP6. Let's kickoff with an example. > > $info = getUserInformation($id); //return an array with all the > information > of an user. > echo $info['naam']; > ?> > > This is nice, but when I want one el

Re: [PHP] Function-return-array idea

2008-01-17 Thread Eric Butera
On Jan 16, 2008 6:32 PM, Stijn Leenknegt <[EMAIL PROTECTED]> wrote: > Hello > > I've an idea for PHP6. Let's kickoff with an example. > > $info = getUserInformation($id); //return an array with all the information > of an user. > echo $info['naam']; > ?> > > This is nice, but when I want one eleme

Re: [PHP] Function-return-array idea

2008-01-16 Thread Per Jessen
Stijn Leenknegt wrote: > This is nice, but when I want one element of the returned array, I > have to store the returned array into a variable and then call the > variable. The next code example is my idea. > > echo getUserInformation($id)['naam']; > ?> > > Let's look further then this small ex

Re: [PHP] Function-return-array idea

2008-01-16 Thread Jim Lucas
I think this would be an easier/quicker fix for you then requesting that the PHP developers re-write a large portion of the way PHP currently works. fetchObjects(), 0)->method(); ?> Stijn Leenknegt wrote: Hello I've an idea for PHP6. Let's kickoff with an example. This is nice, but when

Re: [PHP] Function-return-array idea

2008-01-16 Thread Richard Lynch
On Wed, January 16, 2008 5:32 pm, Stijn Leenknegt wrote: > I've an idea for PHP6. Let's kickoff with an example. This belongs on php-internals... > echo getUserInformation($id)['naam']; > ?> where it has already been discussed at length, and, as I recall, rejected as too obfuscated for the inte

Re: [PHP] Function return

2007-11-02 Thread Dan
I know that while you should be doing proper validation on the server side and everything, you could somewhat diminish the risk of someone building their own form and just posting. If you were to check the referring site which made the post then you could be pretty sure someone didn't make thei

Re: [PHP] Function return

2007-11-02 Thread Nathan Nobbe
On 11/2/07, Stut <[EMAIL PROTECTED]> wrote: > > Dan Shirah wrote: > > That is correct, the due_date field should only accept a valid date > format, > > such as MM/DD/. To bypass the need for a validation check for this > > field I simply set the text field to disabled and supplied the user wit

Re: [PHP] Function return

2007-11-02 Thread Stut
Dan Shirah wrote: That is correct, the due_date field should only accept a valid date format, such as MM/DD/. To bypass the need for a validation check for this field I simply set the text field to disabled and supplied the user with a javascript popup calendar that upon selection populates

Re: [PHP] Function return

2007-11-02 Thread Dan Shirah
That is correct, the due_date field should only accept a valid date format, such as MM/DD/. To bypass the need for a validation check for this field I simply set the text field to disabled and supplied the user with a javascript popup calendar that upon selection populates the date in the form

Re: [PHP] Function return

2007-11-02 Thread Daniel Brown
> On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > TGIF!! I believe that's Copyright (C) TCompuserve. Careful you don't get tsued. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 Give a man a fish, he'll eat for a day. Then you'll find out he was allergi

Re: [PHP] Function return

2007-11-02 Thread Nathan Nobbe
On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > Ah, okay. So I could probably simplfy it more by trimming it from the > start like this?? > > $due_date = trim($_POST['due_date']); > that works; i personally prefer to initialize a variable then only set it if the user input meets some condi

Re: [PHP] Function return

2007-11-02 Thread Dan Shirah
Ah, okay. So I could probably simplfy it more by trimming it from the start like this?? $due_date = trim($_POST['due_date']); On 11/2/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > > > Okay, so instead I should probably use: > > > > if($due

Re: [PHP] Function return

2007-11-02 Thread Nathan Nobbe
On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > Okay, so instead I should probably use: > > if($due_date != "") > $insert2.=", due_date='$due_date'"; > > Instead of using empty() > using emtpy is fine; just store the results of trim in a temporary variable: $trimmed = trim($due_date); if(!e

Re: [PHP] Function return

2007-11-02 Thread Dan Shirah
Okay, so instead I should probably use: if($due_date != "") $insert2.=", due_date='$due_date'"; Instead of using empty() On 11/2/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > > > TGIF!! > > > > I have an insert statement that checks to see

Re: [PHP] Function return

2007-11-02 Thread Nathan Nobbe
On 11/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > TGIF!! > > I have an insert statement that checks to see if a condition is met. If > it > is, then it adds that value to the insert statement. However, when I try > to > run it I get the error: Can't use function return value in write context

RE: [PHP] Function: return multple values

2002-09-23 Thread Jon Haworth
Hi Faisal, > Is it possible to return multiple values in a function. > For instance, i want to do something like this: > > function calculate_money($sum) > { > // some hanky panky calculations > return $type; > return $amount; > } You have to return the values in an array, and use list()

Re: [PHP] function return

2002-05-28 Thread Miguel Cruz
On Tue, 28 May 2002, W. Enserink wrote: > I have a Q about functions. My function should return 2 values. What > syntax should I use and how do I call these values outside the function? > Are these values returned as en array or something? > > > this is what I have now, > ---

Re: [PHP] function return

2002-05-28 Thread 1LT John W. Holmes
Return an array function whatever($var1, $var2) { // do whatever $ret[0] = $var1 + $var2; $ret[1] = $var1 - $var2; $ret['something'] = ($var1/$var2) * 100; return $ret; } $value = whatever(5,4); echo $value[0]; echo $value['something']; ---John Holmes... - Original Message -

RE: [PHP] function return

2002-05-28 Thread Rudolf Visagie
Hi, function myFunction($some_vars, &$max, &$some_value) { $max=count($some_vars); $some_value=($max/2); //return true; } Rudolf Visagie Principal Software Developer Digital Healthcare Solutions Tel: + 27 011 2655478 Cell: + 27 82 895 1598 -Original Message--

RE: [PHP] function return

2002-05-28 Thread David Freeman
> > I have a Q about functions. My function should return 2 > values. What > > syntax should I use and how do I call these values outside the > > function? Are these values returned as en array or something? > I don't know if there is an easier way to do this but why > don't you concate

Re: [PHP] function return

2002-05-28 Thread RIVES Sergio
Hi, I don't know if there is an easier way to do this but why don't you concatenate the two values to be returned and then split the returned value ? ex : function myFunction($some_vars) { $max=count($some_vars); $some_value=($max/2); $result = $some_value.";".$max; return $result; } $resultad

Re: [PHP] function return

2001-04-06 Thread Plutarck
I usually declare $db as global in the function, so I can just execute the function and continue with my querys. -- Plutarck Should be working on something... ...but forgot what it was. "Kurth Bemis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > i'm tryi

Re: [PHP] function return

2001-04-06 Thread Adrian Murphy
should work(works for me).probly something simple. "; } ?> - Original Message - From: Kurth Bemis <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, April 06, 2001 4:10 PM Subject: [PHP] function return > > i'm trying to make all my include files into functions for > manag