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 (permalink)  
Old 10-25-2007, 03:31 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 547
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
Sponsored Links
  #2 (permalink)  
Old 10-25-2007, 03:33 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 237
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
scope variable itbarota HTML, CSS and Javascript Coding Techniques 1 11-13-2007 12:29 AM
What is Value type and reference type in .Net? anbuchezhians VB.NET Programming 2 08-21-2007 10:42 PM
Juggling in PHP? raj PHP Programming 1 07-19-2007 08:04 AM
Static Global Variable and Static Local Variable vigneshgets C and C++ Programming 1 05-30-2007 11:50 AM
Convert integer type variable to char array oyu2o C and C++ Programming 0 03-10-2007 09:47 AM


All times are GMT -7. The time now is 07:29 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0