Jump to content

Archived

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

shams

is this code error?

Recommended Posts

hi,
this is the a php code but the integer part doesn't show any ouput:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$bool = TRUE; // a boolean
$str = "foo"; // a string
$int = 12; // an integer

echo gettype($bool); // prints out "boolean"
echo gettype($str); // prints out "string"

// If this is an integer, increment it by four
if (is_int($int)) {
$int += 4;
}
?>
</body>
</html>
this is the browser ouput:
booleanstring
any help please?

Share this post


Link to post
Share on other sites
Guest footballkid4
Simple: your script doesn't tell the server to display any output. All you're doing is simply adding 4 to the integer that you already have. You would use:
[code]<?php
  echo $int;
?>[/code]
for the integer output.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.