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.
?php
$info = getUserInformation($id); //return an array with all the
information
of an user.
echo $info['naam'];
?
This is nice, but when I want one element of
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.
?php
$info = getUserInformation($id); //return an array with all the information
of an user.
echo $info['naam'];
?
This is nice, but when I want one element of
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
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...
?php
echo getUserInformation($id)['naam'];
?
where it has already been discussed at length, and, as I recall,
rejected as too obfuscated for the
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.
?php
function i($arr, $i) {
return $arr[$i];
}
echo i(getUserInformation($id), 'naam');
#or
echo i($object-fetchObjects(), 0)-method();
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.
?php
echo getUserInformation($id)['naam'];
?
Let's look further then this small
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
allergic
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 with
a
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
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
conditions;
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);
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 if a condition
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
Below
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_date != )
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
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
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() to break
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;
}
$resultado
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 concatenate the
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
mailto:[EMAIL PROTECTED]
Tel: + 27 011 2655478
Cell: + 27 82 895 1598
-Original Message-
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
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,
-
should work(works for me).probly something simple.
?php
function conn(){
$db = mysql_pconnect("localhost", "" ,"");
mysql_select_db("database",$db);
return $db;
}
$db = conn();
$result= mysql_query("select * from table",$db);
while($myrow=MySQL_fetch_array($result))
{
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 trying
24 matches
Mail list logo