loong
asked on
php variable question
hi
refer to below script , why sometime the can run , some time can not ?
is the varible define not correct ?
refer to below script , why sometime the can run , some time can not ?
is the varible define not correct ?
<?php
date( 'd' );
$today = ; $tomorrow = ;
?>
ASKER
hi
thank for reply.
my script error
thank for reply.
my script error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
sorry
there is 2 file, one in public path, one is test folder.
so the file in public folder is error
php -q p.php will be error
php -q ./test/p.php is good,
you right, must define the varible with value.
there is 2 file, one in public path, one is test folder.
so the file in public folder is error
php -q p.php will be error
php -q ./test/p.php is good,
you right, must define the varible with value.
Okay, and what is the error and what is the expected result? This is not clear to me from your question...
If you're new to PHP and want some good learning resources to help you get started, this article may show you some ways forward.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
Here is the original script with some notes that may be helpful. A working version is included.
http://iconoun.com/demo/temp_loong.php
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_11769-And-by-the-way-I-am-new-to-PHP.html
Here is the original script with some notes that may be helpful. A working version is included.
http://iconoun.com/demo/temp_loong.php
<?php // demo/temp_loong.php
/**
* See http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28639654.html
*/
error_reporting(E_ALL);
/**
* THE ORIGINAL SCRIPT POST
*
* This script "does nothing" in that it does not produce any output or other evidence of work.
*
* In PHP, variables are assigned with a single equal sign. The expression on the right of the
* equal sign is evaluated, and the resulting value is placed into the variable on the left of
* the equal sign.
*
* In PHP, the semi-colon is used to terminate statements. A statement that is terminated after
* the assignment (single equal sign) is meaningless and results in a PHP parse error. The script
* is not executed at all.
*
* Note that the original script, shown here, is encapsulated inside the comment statements and
* has no effect, except to document the original code.
*
<?php
date( 'd' );
$today = ; $tomorrow = ;
?>
*/
/**
* A MODIFIED VERSION OF THE SCRIPT
*
* In this script we determine and print the current day and the following day.
*
* Man Page References:
* http://php.net/manual/en/function.time.php
* http://php.net/manual/en/function.date.php
* http://php.net/manual/en/function.strtotime.php
* http://php.net/manual/en/function.var-dump.php
*/
// GET AN INTEGER TIMESTAMP REPRESENTING THE CURRENT TIME
$timestamp_of_now = time();
// FORMAT THE CURRENT DATE IN ISO-8601 STANDARD FORMAT
$printable_date_today = date('c', $timestamp_of_now);
// GET TOMORROW'S TIMESTAMP
$timestamp_of_tomorrow = strtotime($printable_date_today . ' + 1 DAY');
// GET TOMORROW'S DATE IN A DIFFERENT FORMAT
$printable_date_tomorrow = date('l, \t\h\e jS \o\f F, Y', $timestamp_of_tomorrow);
// SHOW THE WORK PRODUCTS
var_dump($printable_date_today);
var_dump($printable_date_tomorrow);
? This doesn't make sense to me: how can the request 'Can you be a just a bit more verbose? ;-)' be a solution?
Open in new window
The other line is just wrong
Open in new window
I don't undertsna what you mean when you say that sometimes it works. Anyway I strongly recommend yout to set error_reporting to E_ALL during development, so you'll get a lot of crucial infos directly by php engine
Open in new window
Do this with the actual script and you'll get a new vision of the universe ;-)