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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

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

Post 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 ?
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Shouldn't it be

Code: Select all

<?php
$param = array ( 
             'root_id' => $id 
);
?>
"=>" instead of "=".
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

Post 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.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

lol
User avatar
PaTTeR
Forum Commoner
Posts: 56
Joined: Wed Jul 10, 2002 7:39 am
Location: Bulgaria
Contact:

Post by PaTTeR »

Damm ... 3 hours and 1 litter coffee :twisted:
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

lmao

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