Hi again,

Now I did a different approach using an array as parameter and giving an
array back.
Strangely though it doesnt really work.

Following "hack" solution works as expected:

$num = pg_numrows($result);
for ($i = 0; $i < $num; $i++)
{
    $ret_arr[$i] = pg_fetch_array($result);
    $ret_arr[$i]["name"] = utf8_decode($ret_arr[$i]["name"]);
    $ret_arr[$i]["title"] = utf8_decode($ret_arr[$i]["title"]);
    $ret_arr[$i]["message"] = utf8_decode($ret_arr[$i]["message"]);
}
return $ret_arr;


Following solution does not:

$num = pg_numrows($result);
for ($i = 0; $i < $num; $i++)
{
    $ret_arr[$i] = pg_fetch_array($result);
    $ret_arr[$i] = unicode_dec($ret_arr[$i]);
}
return $ret_arr;

function unicode_dec($arr)
{
        foreach($arr as $key => $val)
        {
                $arr[$key] = utf8_decode($val);
        }
        return $arr;
}

Why does the 2nd solution not do what it is supposed to?
The 2nd solution works in that it outputs correctly what is in the database
but it does not do unicode decoding on the output, wheras the first solution
does!

I really do not know why this does not work properly!
I am using php 4.2.1

TIA,
Ata


----- Original Message -----
From: "Atahualpa Jones" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 02, 2003 1:27 AM
Subject: [PHP] func_get_args() and call-by-reference?


Hi,

I try to do a function called unicode_enc() which takes a number of
parameters that differ between calls. It should encode all parameters to
unicode using utf8_encode($arglist[$i]).
I am using Variable-length argument lists as described in the manual and
tried to call the function this way: unicode_enc(&$text); but to no success.

Is call-by-reference possible when using func_get_args?

TIA,
Ata


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to