Welcome to PHPMule.com
A blog site which I am posting to during my learning of the popular programming language PHP. Feel free to leave comments!
-
PHP - Using The explode() Function
As it says the explode function is like sticking a dynamite on parts of the string to give you different sections of the string. Lets say we have a list of colors in a variable:
$colors = “blue;yellow;green;orange;white”;
What would happen if we explode them? They would be separated. It’s best if we make an array for them:
$colorarray = explode (”;”, $colors);
As we want to explode the ‘;’ we have to include this in the first part of the function as you can see in the above example. We then include the variable we want to explode after it. After the ‘explosion’ the ‘;’ is basically destroyed leaving the colors separated from each other and subsequently stored in the $colorarray.
(Post created on Monday, April 12th 09 at 22:10)
Leave a reply
-
Archives
Recent Articles
- PHP - Rounding Off Numbers
- PHP - Single vs Double Quotation Marks
- PHP - Loading Files Into Your PHP Script By Using require() and include()
- PHP - Replacing Strings With Other Strings
- PHP - Finding Strings Within Strings
- PHP - Using strlen() To Test String Length
- PHP - Using The explode() Function
- PHP - Changing The String Case
- PHP - The nl2br() Function
- PHP - Trimming Strings
Links
Categories
- PHP (22)
- Uncategorized (1)


