Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Php with shred to characters in variable

Php with shred to characters in veriable

11:13 am on Jun 16, 2013 (gmt 0)

New User

joined:June 11, 2013
votes: 0

hi guys
i am from turkey.i am sorry for my bad english

i want to shred to characters in veriable
for examle,

$variable="Fred love to php";

$variable2=function x($variable);

echo $variable2[0];


echo $veriable2[1];
i want to spaces
2:58 pm on June 16, 2013 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts: 15755
votes: 0

Hello erkin0007,

is this maybe what you are looking for? str_split [php.net]
7:27 am on June 17, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Oct 15, 2004
votes: 0

you can also use explode()

$variable = "Fred love to php";
$characters = explode("", $variable);
// $characters is now an array, each val equals a letter from your string

echo $characters[3]; // will print 'd'