<Original message>
From: Gerard Samuel <[EMAIL PROTECTED]>
Date: Wed, Aug 29, 2001 at 09:58:12PM -0400
Message-ID: <[EMAIL PROTECTED]>
Subject: Re: [PHP] strings in a function return

> I found an error, but it didn't do me any good.
> I tried this, any tips...
> Thanks
> 
> function assign() {
>             global $adminurl, $string;
>             top();
>             if ($string) {
>                     $data = explode ("|", $string);
>                     foreach ($data as $foo) {
>                       echo $foo[0]; }
>                               }
>               <form>
> 
>       $array = array("$new_cat","$assigned_to","$job","$assigned_by");
>       $string = implode("|",$array);
>           return  $string;
> }
> 
> The variables that form $array are from the form....

</Original message>

<Reply>

Why use array("$new_cat",...,"$assigned_by");
Loose the quotes: array ($new_cat,...,$assigned_by);

You don't need to use implode(). Just return the array. In the
calling function you can then get the results in two ways:

  $results = assign();  /* $results is an array */
or
  list ($new_cat,...,$assigned_by) = assign();

If you want a better answer on what is going wrong, you'll need to
send some more code. Eg the code that you've now replaced by <form>.
It might just be that the error is in that part.

</Reply>

-- 

* R&zE:


-- »»»»»»»»»»»»»»»»»»»»»»»»
-- Renze Munnik
-- DataLink BV
--
-- E: [EMAIL PROTECTED]
-- W: +31 23 5326162
-- F: +31 23 5322144
-- M: +31 6 21811143
--
-- Stationsplein 82
-- 2011 LM  HAARLEM
-- Netherlands
--
-- http://www.datalink.nl
-- ««««««««««««««««««««««««

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to