Welcome to WebmasterWorld Guest from 54.204.92.234

Forum Moderators: coopster & jatar k

Php with shred to characters in variable

Php with shred to characters in veriable

   
11:13 am on Jun 16, 2013 (gmt 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];

RESULT

"f"
************************************************************************
echo $veriable2[1];
RESULT
"r"
*****************
i want to spaces
2:58 pm on Jun 16, 2013 (gmt 0)

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



Hello erkin0007,

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

WebmasterWorld Senior Member 10+ Year Member



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'
 

Featured Threads

Hot Threads This Week

Hot Threads This Month