The reverse of turning ASCII text into HTML is to convert HTML into ASCII. And to this end here is a little function that does this.
Providing a text box for users to type information in is very common, but usually people want to include line breaks and links with the text and they expect the site to lay it out just as they had intended it. The following function will turn any ASCII text string into the approximate HTML equivalent.
To change a table name in MySQL you can use the ALTER TABLE command with the parameter RENAME TO. Here is an example of a query that will rename the table "atable" to "newtable".
Use the following function to change any integer into a string containing the integer value as a Roman Numeral.
When people link to your images from their own site they are essentially using your bandwidth to show images on their site, this is also known as hotlinking.
The simplest way of preventing people from doing this is to add a .htaccess file to only allow locally linked images to be served. This checks the domain that is linking to your images by using the referrer and if the domain does not equal you own site then a different image is served, in this case blank.jpg.
Krumo is an open source plugin for your programs that is designed as a replacement to print_r() and var_dump(). These functions are used by developers (myself included) to find out what the program is doing. The main problem is that if there is a lot of data to look at the page can get a bit busy.
Cutting a string to a specified length is accomplished with the substr() function. For example, the following string variable, which we will cut to a maximum of 30 characters.
It is possible to find out what functions and variables are available from an object at runtime using the PHP functions get_class_methods() and get_object_vars().
Take the following class called testClass.
The $_SERVER superglobal array contains lots of information about the current page location. You can print this off in full using the following line of code.