I wants to concatenate $today variable in url and 0530&(India Standard Time) string. The url should be like this http://example.com/check?image=true&id=Thu Oct 20 2016 19:29:17 GMT+0530 (India Standard Time)
after concatenation. Tied my self but still facing the problem. Anyone can help? Thank you
<? php
$today = date("D M j Y G:i:s T ");
echo < img src = '"http://example.com/check?image=true&id=" .$today. "0530&(India Standard Time)"' />
?>
</div>
Try this:
echo '<img src="http://example.com/check?image=true&id=' . $today . '0530&(India Standard Time)" />';
You can't use a & in a URL, it's a reserved char. You need to use the urlencode and urldecode function to do so.
<?php
$today = urlencode(date("D M j Y G:i:s T") . "0530&(India Standard Time)");
echo '<img src="http://example.com/check?image=true&id=' .$today .' />';
echo 'To Decode: ' . urldecode($today);
?>
This will output
<img src="http://example.com/check?image=true&id=Thu+Oct+20+2016+16%3A15%3A02+CEST0530%26%28India+Standard+Time%29 />To Decode: Thu Oct 20 2016 16:15:02 CEST0530&(India Standard Time)