Hey

I have the following:

<?php echo $_COOKIE["name"];?>
<?php echo $_item->getId();?>

With the $_COOKIE["name"] having a value of "hi" and the $_item->getId() having a value of "5" (or 5, irrelevent as it is all strings)

what if I want to do something like (fake nonworking code):

concat joins 2 strings.

echo concat($_COOKIE["name"],$_item->getId());

Which would print out "hi5".

How can I do this?

Thank you

Recommended Answers

All 2 Replies

try,

<?php
   $scookie = "hi";
   setcookie("Cookie",$scookie);
   $someString = "5";

   echo $_COOKIE["Cookie"].$someString;
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.