Common PHP Questions by FunctionBelow is a list of common functions used in the PHP and mySQL examples on this site. If you want to know about a particular function and see an example of that function in use rather than having a specific question, you will find this index a useful tool in quickly finding out a function. The majority have a clear and simple example of how to use a function so that you can get to grips and start using a function quickly whatever your knowledge of PHP.
How do I escape a string with slashes?
How do I escape data that is going into a database?
How do I count the number of times a value appears in an array?
I want to invert my array, can I do this?
I am not interested in the values in the arrays, how can I discard them?
How can I sort a multi-dimensional array?
How do I remove and view the last element of an array?
How do I add to the end of an array and know how large the array is?
How do I pick a random value from an array?
How do I reverse the order of the elements in an array?
How do I remove the first element from an array?
How do you remove duplicate values from an array?
How do we sort an array of names taken from a text file, displaying only unique names?
How do I add to the beginning of an array and find the number of elements in it?
How do I return all the values in an array?
How can I reverse sort an array keeping the correlation between the index and value?
How can I sort an array keeping the correlation between the index and value?
How do I round up a number?
How do I check if a date entered exists?
How can I remove trailing space from a string?
count and sizeof
How do I find the size of an array?
How can I check that a data value is alphanumeric?
How do I insert the date into my table?
How do I display todays date on my website?
How do I print text to the screen?
How do I check for an empty field in a form?
How do I check that a valid email address is entered?
How do I break email address into username and hostname?
How do I count the number of words in my text?
How do I turn a string into an array?
What is the use of file in php?
How do I round down a number?
How do I open a file to write content to?
How can I loop through the members of an array?
How can I display values in a two dimensional array?
How do you get an array of the date and time?
How to find a domain name for an IP address?
How do I know if magic quotes is switched on?
How do I make a variable from outside a function work in that function?
How do I send HTTP headers with PHP?
How do I perform a 301 redirect with PHP?
How do I convert relevant characters in a string to HTML entities?
How can I find the colour of a pixel of an image?
How can I rotate an image?
imagesx and imagesy
How can I find the width and height of an image resource?
How can I add text to an image?
How do I turn an array into a string?
How do I keep my site menu in one file?
How do I force a value to be treated as a number?
How can I check if a value is already in an array?
How do I find out if a value is already in an array?
How do you check if a variable is set or not in PHP?
How do I check if a variable is of array type?
How can I check a value entered in a field on my form is a number?
How do I reverse sort an array by key?
How do I sort an array by key?
How do I find the longest value in my mysql table?
How do I email the contents of a form to me?
is there any sendemail function in php for sending contents of a form through email?
How do I calculate the metaphone of a string?
How do I find the timestamp for a particular date?
How do I find the number of rows affected by a query?
How do I find the ID of a new row added to a table?
How do I find the number of rows in a result set?
How do I find second highest value from a table?
How do I sort alphanumeric array data correctly?
How do I convert newlines to HTML line break tags?
How do I display newline characters on a webpage?
How do I format a number with commas like a monetary value?
How do I find the ASCII value of a string character?
How do I extract the values of variables from a string?
How do I find out about my PHP installation?
print and echo
What is the difference between print and echo?
How do I format the output of a string?
print_r and var_dump
How can I easily view all members of an array?
How do I generate a random number?
How can I create an array of the letters of the alphabet?
How can I create an array of numbers easily?
How do I make sure an include file exists before loading the page?
How can I reset an array in PHP?
How do I return a value from a function?
How do I reverse sort the members of an array?
How do I remove trailing whitespace from a string?
How can I stop my PHP script timing out?
How can I mix up the order of values in an array?
How do I sort the members of an array by value?
How do I get a variable in a function to retain its value between calls?
How do I remove escape characters from data?
I retrieve data from a Mysql database and insert it into a textfield form. The data that I retrieve have a / at the end of the string. The data in the database does not have this / in the data. How do I remove this /?
How do I remove HTML tags from a string?
How do I check if a string contains HTML?
How do I find the length of a string in PHP?
How do I find the position of a letter in a string in PHP?
How do I reverse a string in PHP?
How do I find the last occurrence of a character in a string?
How do I make the contents of a string lower case?
How do I make the contents of a string upper case?
How do I make sure a string is a certain length?
How can I repeat a string variable several times?
How do I replace a word in a string in PHP?
How do we count paragraphs or newlines?
How can I remove spaces from around a string value?
How do I make the first letter of a string uppercase?
How do I make the first letter of each word upper case?
How do I remove an element from an array without changing the index values for the rest of the array?
How do I write my own sort function?