- Forums
- PHP
- How To Break A String Into An Array In Php using explode()
This Page Contains information about How To Break A String Into An Array In Php using explode() By wallpaperama in category PHP with 1 Replies. [1212], Last Updated: Sat May 18, 2024
wallpaperama
Wed Nov 26, 2008
1 Comments
741 Visits
explode()
if you want to break a string into an array you can use the explode() function in php. its simple
for example
i will break this sentence into an array
$string = 'I love Wallpaperama';
the delimiter that will separate the words is the space
$string = explode(' ',$string);
as you can see from my example, i will now have an array called $string with three different values
PHP CODE
echo $string[0];
echo $string[1];
echo $string[1];
the output will look like this:
OUTPUT
I
love
Wallpaperama
https://www.wallpaperama.com/forums/how-to-break-a-string-into-an-array-in-php-t6796.html