Posted by: Sourav | February 18, 2011

Typecasting in PHP


<html>
<head>
<title>
Typecasting
</title>
</head>
<body>
<?php
$sourav1=”5″;
$sourav1+=100;
echo $sourav1;
echo “<br />”;
$sourav2=”how are u”;
$sourav+=67;
echo $sourav2;
echo ‘<br />’;
echo gettype($sourav1);
echo “<br />”;
echo gettype($sourav2);
echo “<br />”;
settype($sourav2,”integer”);
echo gettype($sourav2);
echo “<br />”;
echo $sourav2;
echo “<br />”;
settype($sourav2,”string”);
$sourav3=(int)$sourav2;
echo gettype($sourav3);
echo “<br />”;
echo $sourav3;


?>

</body>
</html>

 

See php official website for more information.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: