php variable question

hi
refer to below script ,  why sometime the can run , some time can not  ?

is the varible define not correct ?

<?php

 date( 'd' );    

$today = ; $tomorrow = ;

?>

Open in new window

loongAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marco GasiFreelancerCommented:
I'm sorry, that doesn't make sense to me. The first line is missing an echo or a variable assignement:

$mydate = date['d'];
//or
echo date['d'];

Open in new window


The other line is just wrong

$$today = ; //where's the value?
$tomorrow = ; //where's the value?

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

<?php
error_reporting(E_ALL);

//here the rest of code

Open in new window


Do this with the actual script and you'll get a new vision of the universe ;-)
0
loongAuthor Commented:
hi
thank for reply.
my script error
0
Marco GasiFreelancerCommented:
Can you be a just a bit more verbose? ;-)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

loongAuthor Commented:
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.
0
Marco GasiFreelancerCommented:
Okay, and what is the error and what is the expected result? This is not clear to me from your question...
0
Ray PaseurCommented:
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.
http://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);

Open in new window

0
Marco GasiFreelancerCommented:
? This doesn't make sense to me: how can the request 'Can you be a just a bit more verbose? ;-)' be a solution?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.