Page 1 of 1

variables going crazy ... or may be I ...

Posted: Sat Sep 07, 2002 9:03 am
by PaTTeR
Hallo,

I have this part of code

Code: Select all

<?php
list($id,$name,$desc) = explode ('|',$begin);
?>
After this $id is string, and its value is 100.

this is next part of code

Code: Select all

<?php

$param = array (
             'root_id' = $id
);

$param = xslt_process(xslp, 'agr:/_xml','arg:/_xsl', NULL, $arg, $param);


?>

So this not work :(

when I replace $id in $param 'root_id' => '100' , everything is o.k.
when I set $id = '100' , everything is o.k.

but when i set $id via list() .... :evil:

this is one test

Code: Select all

<?php

echo 'id is .'$id.'.of type '.gettype($id); // don't work
$id = '100';
echo 'id is .'$id.'.of type '.gettype($id); // work

?>
this output this :

id is .100. of type string
id is .100. of type string



Have an idea what is wrong ?

Posted: Sat Sep 07, 2002 11:42 am
by Takuma
Shouldn't it be

Code: Select all

<?php
$param = array ( 
             'root_id' => $id 
);
?>
"=>" instead of "=".

Posted: Sat Sep 07, 2002 11:52 am
by PaTTeR
00pS, everything is O.K.
i find the problem.

so variable $result in list() is returned from xslt parser too , but i forgot that - xmls parser return a xml header "<?xml .......... ?>"

now I'm using this :

Code: Select all

&lt;?php
$id = substr($id,strpos($id,'?&gt;')+2);
?&gt;
and all is fine :oops:

10x Takuma, I recieve yuor reply in the moment when i write this.

Posted: Sat Sep 07, 2002 2:20 pm
by Takuma
lol

Posted: Sun Sep 08, 2002 3:53 am
by PaTTeR
Damm ... 3 hours and 1 litter coffee :twisted:

Posted: Sun Sep 08, 2002 4:37 am
by m3mn0n
lmao

...i've had many similar experiences...