Hello,
This is a reply to an e-mail that you wrote on Thu, 10 Jul 2003 at 15:30,
lines prefixed by '>' were originally written by you.
> If i have a valid sql query that returns three the records
> 'john','jack' and 'mary' and i want to put that into an array where
> array[0]->john,array[1]->jack
Hi All
Im new to php and are getting a bit confused about the sybase_fetch_array function (i
think that this is the same as mysql_fetch_array?).
If i have a valid sql query that returns three the records 'john','jack' and 'mary'
and i want to put that into an array where array[0]->john,array[
Op dinsdag 13 augustus 2002 20:50, schreef Alexander Ross:
> If I have a string variable that is already of the form
> ('item','item2','item3') [including the parens and quotes in the string],
> is there an easy way to change that variable into an array??
> Array($var) doesn't work. Thanks
--
Two ways I can think of off the top of my head:
$s = "('item','item2','item3')";
preg_match_all("/'(.*?)'/",$s,$regs);
$result = $regs[1];
or
$s = "('item','item2','item3')";
eval('$result = array'.$s.';');
Neither is very efficient though. eval() is particularly ugly.
-R
If I have a string variable that is already of the form
('item','item2','item3') [including the parens and quotes in the string],
is there an easy way to change that variable into an array??
Array($var) doesn't work. Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, vi
> "S" == "stas" <[EMAIL PROTECTED]> writes:
> Thanks, I know that, but I don't want to type out assignments
> manually, as my list of my form values will grow. However, I solved
> very simply like this:
> $form_val_list =
>"firstname,lastname,address,address2,city,state,zip,phone,ema
Thanks, I know that, but I don't want to type out assignments manually, as
my list of my form values will grow. However, I solved very simply like
this:
$form_val_list =
"firstname,lastname,address,address2,city,state,zip,phone,email,resume";
$form_arr = explode (",", $form_val_list);
while (lis
> I am trying to create an associative array dynamically.
> Here's what I did first:
> $form_val_list =
> "firstname,lastname,address,address2,city,state,zip,phone,emai
> l,resume";
> $form_arr = explode (",", $form_val_list);
> while (list ($key, $val) = each ($form_arr))
> {
>ech
Hello,
I am trying to create an associative array dynamically. Here's what I did first:
$form_val_list =
"firstname,lastname,address,address2,city,state,zip,phone,email,resume";
$form_arr = explode (",", $form_val_list);
while (list ($key, $val) = each ($form_arr))
{
echo "$key i
9 matches
Mail list logo