Jump to content

PHP split() No output values ????


opencombatclan

Recommended Posts

Hi there.

I have the following code:

<?php
$data = split('/\|/', $_COOKIE["sc1"]);
$scc = $data['0'];
$p = $data['1'];
$s = $data['2'];
$d = $data['3'];
$rd = $data['4'];
$sp = $data['5'];
$h = $data['6'];
$b = $data['7'];
$hout = $data['8'];
$k_a = $data['9'];
$k_po = $data['10'];
$k_pb = $data['11'];
$k_pl = $data['12'];
$k_pr = $data['13'];
echo $p;
?>

the cookie [sc1] contains:

Kozijn 1|1|4|67|28|8|1000|2000|0|0|0|0|0|0|0|0|2000|1000|0|0|0|0|0|0|0|-1|0|0|0|67|67|1866|866|0|0|0|

So i expect to see a output on my site witch shows me: "1".

But i see a empty window!???

How is this possible, and whats going wrong?

Cuz i hoped the value "1" from the cookie (value 1 on row), would be stored in $p

But it seems its not working right now...

 

Plse help me out.

I have to know what i am doing wrong...

 

Yours faithfully,

steven

 

Link to comment
https://forums.phpfreaks.com/topic/115206-php-split-no-output-values/
Share on other sites

Try this instead:

<?php
list($scc,$p,$s,$d,$rd,$sp,$h,$b,$hout,$k_a,$k_po,$k_pb,$k_pl,$k_pr) = explode('|',$_COOKIE["sc1"]);
echo $p;
?>

 

Ken

 

Yeaaaaah...

It worked!

Thank you so much!

But can u also explain why my method did not work?

I wanna understand php a bit more...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.