.navigation Home Projects Scripts About Me Contact

String To Array

File Information

 

Filename : stringtoarray.zip

Language : PHP

Type : Function

MD5 : b4ad76ae5ed6bcd7ff303c58583d35f7

Download Now!

 

This function is pretty straight forward. Give a string, and it splits up each character of the string and pushes each character into an array.

I created this function when I had to do specific things to the first and third letter of the given string. (Don't ask). With this function, I can use any character in the string that I'd like.

Usage :

Let's use my name as an example.

$string = "Francisco";

To use this function, simply include the .inc file in the downloadable zip file into the file that you want to use stringtoarray on.

Here's what the code will look like :

$string = "Francisco";
$stringarray = stringtoarray($string);

$stringarray will be indexed as follows :

$string[0] = F
$string[1] = r
$string[2] = a
$string[3] = n
$string[4] = c
$string[5] = i
$string[6] = s
$string[7] = c
$string[8] = o

Francisco Guerra - Site Map - © Fguerra.net 2002-2005