Note: This is not a YII question but rather just simple php
I am creating a simple php code to get a date.
<?php $today = date('l \t\h\e jS');
define('TODAY','$today');
echo 'Today is '.TODAY.'' ;
?>
The above code does not work.
I am planing to get the value for $today variable in define function.
I can however do it simple way by just replacing TODAY in " echo 'Today is '.TODAY.'' ; " with $today..
But i want to know what variable is not working inside the define constant.
is that illegal ?
Page 1 of 1
PHP declare function using variables inside declare
#2
Posted 06 July 2012 - 03:42 PM
/* Moved from Tutorials to Misc - General PHP */
http://php.net/manua...tion.define.php
Do not quote the variable, and don't use single-quotes for the constant:
http://php.net/manua...tion.define.php
Do not quote the variable, and don't use single-quotes for the constant:
define("TODAY", $today);
"Less noise - more signal"
Share this topic:
Page 1 of 1

Help













