IT Community - Software Programming, Web Development and Technical Support

PHP Variable type juggling in PHP

This is a discussion on PHP Variable type juggling in PHP within the PHP Programming forums, part of the Web Development category; Hi all... PHP Variable type juggling in PHP Thanks......


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 10-25-2007, 02:31 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 542
itbarota is on a distinguished road
Default PHP Variable type juggling in PHP

Hi all...


PHP Variable type juggling in PHP


Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 10-25-2007, 02:33 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 235
Pvinothkumar is on a distinguished road
Default Re: PHP Variable type juggling in PHP

Hi all....


PHP doesn't require variables to declared using primitive types. Therefore, juggling between two types doesn't require use of any special function. We can simply do things like...

<?php
//string var
$var = "0";

//var is now float
$var += 2.5;

//var is now integer
$var += 2;

//var is now string
$var .= " is the total";

echo $var;
?>

The above code outputs "4.5 is the total".


Thanks...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
@ in variable jennifergttfrd PHP Programming 0 12-27-2008 07:46 AM
What is Value type and reference type in .Net? anbuchezhians VB.NET Programming 2 08-21-2007 09:42 PM
Juggling in PHP? raj PHP Programming 1 07-19-2007 07:04 AM
Static Global Variable and Static Local Variable vigneshgets C and C++ Programming 1 05-30-2007 10:50 AM
Convert integer type variable to char array oyu2o C and C++ Programming 0 03-10-2007 08:47 AM


All times are GMT -7. The time now is 03:43 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0