Comparing PHP to ASP - Week 3 - Number Functions
24 May 2010 - tips-tutorials
Welcome to the third part of our 5 part tutorial where we will compare PHP with Classic ASP.
The objective of these tutorials is to show you how to do some basic programming in PHP and compare it to how you would do it in Classic ASP using VB Script.
This five part tutorial will be split into five sections:
Random number Between 1 and 10 in PHP
Random number Between 1 and 10 in Classic ASP
Both of these examples would output a random number between 1 and 10.
Rounding a Number Down in PHP
For each of these examples, we will round down the value 5.7
Rounding a Number Down in Classic ASP
The integer 5 would be returned to the browser.
Rounding a Number Up in PHP
For each of these examples we will round the number 63.454564 up to 2 decimal places.
Rounding a Number Up in Classic ASP
Both of these examples would output the value 63.45
Checking if a value is an Integer in PHP
In PHP, we use the is_numeric() function. This returns TRUE if the value passed in IS an integer and FALSE if it IS NOT.