Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Casting Variables in php

Mon Oct 27, 2008 6:03 pm

Code:

<html>
<head>
<title>Casting a variable</title>
</head>
<body>
<?php
$undecided 
3.14;
$holder = ( double ) $undecided;

print 
gettype$holder ) ; 
print 
" -- $holder<br>";   
$holder = ( string ) $undecided;
print 
gettype$holder );  
print 
" -- $holder<br>";   

$holder = ( integer ) $undecided;
print 
gettype$holder );  
print 
" -- $holder<br>";   

$holder = ( double ) $undecided;
print 
gettype$holder );  
print 
" -- $holder<br>";   

$holder = ( boolean ) $undecided;
print 
gettype$holder );  
print 
" -- $holder<br>";   
?>
</body>
</html>




Post a reply
  Related Posts  to : Casting Variables in php
 Local variables vs Instance variables     -  
 casting to char + end of file     -  
 Array Casting in java     -  
 PHP Variables     -  
 Apache Variables in php     -  
 PHP session variables     -  
 Variables Are Assigned by Value     -  
 Scope Variables in php     -  
 Modify Session Variables     -  
 Print all server variables     -  

Topic Tags

PHP Variables