Jump to content


Photo

is this code error?


  • Please log in to reply
1 reply to this topic

#1 shams

shams
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 27 March 2006 - 05:09 AM

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?

#2 Guest_footballkid4_*

Guest_footballkid4_*
  • Guests

Posted 27 March 2006 - 05:14 AM

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:
<?php
  echo $int;
?>
for the integer output.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users