Lost Password?


  #1 (permalink)  
Old 01-10-2007, 06:12 PM
clookid's Avatar   
clookid clookid is offline
Programmer
 
Join Date: Jan 2007
Posts: 148
Rep Power: 7
clookid is on a distinguished road
Default Type Casting

Type casting

Like Perl, variables are cast automatically into the right types (integer, floating point, string, etc.) though you can force them if you want. Just put the required type in front of the variable in brackets

PHP Code:
  $mynum 3.01;
  
$intnum = (int) $mynum
Check this out in the PHP manual if you want to know more about typecasting. In general it's not necessary since there are functions for dealing with (for example) number formatting.

This tutorial was written by another one of my friends, if you would like to use this tutorial please send me a PM

Last edited by clookid; 01-11-2007 at 12:54 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-11-2007, 09:32 PM
xtraze xtraze is offline
Programming God
 
Join Date: Dec 2006
Location: Sri lanka
Posts: 921
Rep Power: 0
xtraze is on a distinguished road
Send a message via MSN to xtraze Send a message via Skype™ to xtraze
Default

Better do this lol,
else problems can occur in some places, pre-caution is better.
And can you list some variable types here,

(int),....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
G++ Error: cannot pass objects of non-POD type Ronin C and C++ 4 10-01-2007 05:35 AM
XML-JSP content Type problem hbmehta15 JavaScript and CSS 3 06-19-2007 04:39 AM
Browser Type Chan JavaScript and CSS 3 05-23-2007 01:28 PM
Unbound type constructor snowfall General Programming 0 04-25-2007 04:01 PM
What type of phone do you have? Crane Technology Ramble 22 08-28-2006 11:49 AM


All times are GMT -5. The time now is 06:55 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads