homepage Welcome to WebmasterWorld Guest from 54.226.43.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Php with shred to characters in variable
Php with shred to characters in veriable
erkin0007




msg:4584596
 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

 

jatar_k




msg:4584617
 2:58 pm on Jun 16, 2013 (gmt 0)

Hello erkin0007,

is this maybe what you are looking for? str_split [php.net]

omoutop




msg:4584814
 7:27 am on Jun 17, 2013 (gmt 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'

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved