Jump to content

Type Casting


iwato

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...