Jump to content

Type Casting


iwato
 Share

Recommended Posts

QUESTION: Why am I told -- after just setting the variable type of $tz_CET to an integer -- that an unexpected T_STRING is encountered in the statement that reads: $tz_CET = $tz_CET + (60 + 60);

				if (date_default_timezone_set("Europe/Berlin")) {					$tz_CET = date("Z");					settype($tz_CET, "integer");					if (date("I")) {						$tz_CET = $tz_CET + (60 x 60);						echo "Daylight savings time is in effect for " . date_default_timezone_get() . ".<br />";					}				} else {					echo "Timezone reset unsuccessful.";				}

Roddy

Link to comment
Share on other sites

I see an "x", not a "+":

$tz_CET = $tz_CET + (60 x 60);

The multiplication operator is the asterisk, "*".P.S. the error has nothing to do with the typecasting.

Link to comment
Share on other sites

The multiplication operator is the asterisk, "*".
You can tell I am still a beginner.Everything works fine now.Thanks, Synook, for the correction.Roddy
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...