php-windows Digest 11 Aug 2004 09:35:07 -0000 Issue 2355
Topics (messages 24377 through 24380):
Re: Passing arrays by reference
24377 by: Jim MacDiarmid
24378 by: Jim MacDiarmid
You can all take a look
24379 by: PHPDevX
ldap and openssl under windows
24380 by: Christophe Gesch�
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Thanks, That seems to have worked. Now, can you or someone tell me why I
can't seem to get it to work when I separate the function implementation
from the calling statemtent? For instance:
Say I have the following function in file called "My_Function_Includes.php":
<?php
function foo(&$a)
{
for ($i=0; $i < 10; $i++)
{
$a[$i] = $i;
}
}
?>
In my index.php I have:
<?php
Include_once('My_Function_Includes.php');
$a = array();
foo($a);
echo "<PRE>";
print_r($a);
echo "</PRE>";
?>
This example doesn't seem to work however, when I paste the function
implementation into the index.php and run it, it works.
Thanks for any help in advance,
Jim
-----Original Message-----
From: Justin Patrin [mailto:[EMAIL PROTECTED]
Sent: Monday, August 09, 2004 5:52 PM
To: Jim MacDiarmid
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Passing arrays by reference
On Mon, 9 Aug 2004 17:28:40 -0400, Jim MacDiarmid
<[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> I've seen several examples of passing arrays by reference such as the
> following:
>
> $a = array();
>
> function foo(&a)
function foo(&$a)
> {
> for ($i=0; $i < 10; i++)
> {
> $a[$i] = $i;
> }
> }
>
> foo($a);
> echo "<PRE>";
> print_r($a);
> echo "</PRE>";
>
> However, when I try this on my setup, it doesn't work and I get the
> following error message:
>
> PHP Parse error: parse error, unexpected T_STRING, expecting
> T_VARIABLE in...
>
> Anyone have any ideas or suggestions?
>
> Thanks,
> Jim
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Ok, well... While that was just an example.. In my real code, I'm
attempting to pass 2 arrays by reference, and the function I'm passing to
is in an include file.
Is passing my reference something that is commonly done in PHP or do most
developers use globals? I'm just trying to be as efficient as possible.
:-)
Thanks,
Jim
-----Original Message-----
From: ????????? ??????? [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 10, 2004 11:10 AM
To: Jim MacDiarmid
Subject: Re: FW: [PHP-WIN] Passing arrays by reference
Здравствуйте, Jim.
Вы писали 10 августа 2004 г., 16:05:19:
JM> Thanks, That seems to have worked. Now, can you or someone tell me
JM> why I can't seem to get it to work when I separate the function
implementation
JM> from the calling statemtent? For instance:
JM> Say I have the following function in file called
"My_Function_Includes.php":
JM> <?php
JM> function foo(&$a)
JM> {
JM> for ($i=0; $i < 10; $i++)
JM> {
JM> $a[$i] = $i;
JM> }
JM> }
?>>
JM> In my index.php I have:
JM> <?php
JM> Include_once('My_Function_Includes.php');
JM> $a = array();
JM> foo($a);
JM> echo "<PRE>";
JM> print_r($a);
JM> echo "</PRE>";
?>>
JM> This example doesn't seem to work however, when I paste the function
JM> implementation into the index.php and run it, it works.
JM> Thanks for any help in advance,
JM> Jim
JM> -----Original Message-----
JM> From: Justin Patrin [mailto:[EMAIL PROTECTED]
JM> Sent: Monday, August 09, 2004 5:52 PM
JM> To: Jim MacDiarmid
JM> Cc: [EMAIL PROTECTED]
JM> Subject: Re: [PHP-WIN] Passing arrays by reference
JM> On Mon, 9 Aug 2004 17:28:40 -0400, Jim MacDiarmid
JM> <[EMAIL PROTECTED]> wrote:
>>
>> Hi everyone,
>>
>> I've seen several examples of passing arrays by reference such as the
>> following:
>>
>> $a = array();
>>
>> function foo(&a)
JM> function foo(&$a)
>> {
>> for ($i=0; $i < 10; i++)
>> {
>> $a[$i] = $i;
>> }
>> }
>>
>> foo($a);
>> echo "<PRE>";
>> print_r($a);
>> echo "</PRE>";
>>
>> However, when I try this on my setup, it doesn't work and I get the
>> following error message:
>>
>> PHP Parse error: parse error, unexpected T_STRING, expecting
>> T_VARIABLE in...
>>
>> Anyone have any ideas or suggestions?
>>
>> Thanks,
>> Jim
>>
>> --
>> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
>> http://www.php.net/unsub.php
>>
JM> --
JM> DB_DataObject_FormBuilder - The database at your fingertips
JM> http://pear.php.net/package/DB_DataObject_FormBuilder
JM> paperCrane --Justin Patrin--
JM> --
JM> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
JM> http://www.php.net/unsub.php
Try to use
<?
function foo()
{...
return $a;
...
}
$a = array();
$a = foo();
?>
or
use $_GLOBALS array in your function, but to my mind it is not good idea
--
С уважением,
Александр mailto:[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hello all,
Many of us need help solving more or less complicated issues.
And what do you do? You post a message and wait for an answer to come up.
Now some people post replies to your message giving their oppinion.
Maybe this will help you, maybe not. You wait for more. Keep asking these
people who answered you, but many times you feel like your question is not
understood
and nobody is willing to spend some time to understand you.
I think this situation is very normal.
What I am trying to do is to determine the need of a paid support system
I wish to implement. For small amounts people can get help very fast.
Speaking for myself, I would rather pay some money to get help when I need
than wait for an answer that might never come up.
Please take a minute to vote.
Do you think such a paid support system is needed?
YES - http://81.196.199.2:8080/vote.php?option=yes
NO - http://81.196.199.2:8080/vote.php?option=no
--- End Message ---
--- Begin Message ---
I need to test an ldaps connection with a php script running on
windows XP. I can't found where I need to place my .pem file
--
---------------------------------
Moosh -- php.net -- phpfrance.com
=== Php & Pear @ Fosdem 2005 ===
--- End Message ---