Rounding And Displaying Numbers In PHP

24th December 2007

To round a number in PHP you can use one of three functions, these are round(), ceil() and floor(). All of these functions take number as the input and will round the value depending on the function used.

To round to the closest integer use the round() function.

Does A String In PHP Contain A Number?

24th December 2007

The is_numeric() function in PHP can be used to see if a number contained in a string is numeric. The function returns true is the variable can be parsed into a string, otherwise it returns false. Here are some examples:

Generate A Select Box For A HTML Form

Here is a function to generate a select box for a HTML form. The three parameters are:

philipnorton42 Fri, 12/21/2007 - 09:05

Printing Arrays Using print_r()

20th December 2007

When debugging PHP code the print_r can be useful if you want to know what an array or object contains. It will take any variable as input and will print off as much information as it can about that variable. The following code.

Linking An RSS Or Atom Feed to a HTML Document

20th December 2007

Adding a hyper link for an RSS or Atom feed on your web page works, but that's not all you can do. By adding a link to the head section of the page you can allow your users an alternative method of picking up your feed.

To add an RSS feed use this.