Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-06-2013, 03:07 AM   PM User | #1
anotherJEK
Regular Coder

 
Join Date: Aug 2010
Location: Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
Posts: 150
Thanks: 41
Thanked 1 Time in 1 Post
anotherJEK is an unknown quantity at this point
split a string with no spaces to an array?

I want to split a string of ascii characters with no spaces into an array of individual characters.

I looked at the php manual and found that explode() will not accept an
empty string as a delimiter.

So I am trying
PHP Code:
$this->shrtCodeLst explode(' 'str_replace(''' '$this->codeStr));
 print  
str_replace(''' '$this->codeStr); //testing:  prints string without spaces 
I also look back at the str_replace() entry in the manual and it does not
say anything about empty string for search parameter.
So... Are there any suggestions, inside info, etc here?
I am writing code to generate a captcha graphic and want to apply
some choice to the amount and configuration of the characters in
the string.

Unless I have been blind to a dumb typo, I seem to remember having
done this successfully elsewhere in php v5 code (use empty string as
search parameter in str_replace())

Thanks for time and attention
anotherJEK is offline   Reply With Quote
Old 02-06-2013, 04:16 AM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
PHP Code:
$a str_split($this->codeStr); 
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
anotherJEK (02-06-2013)
Old 02-06-2013, 05:25 AM   PM User | #3
anotherJEK
Regular Coder

 
Join Date: Aug 2010
Location: Now Southern Oregon. I was born and had lived my life in Los Angeles until relocating last year (2010)
Posts: 150
Thanks: 41
Thanked 1 Time in 1 Post
anotherJEK is an unknown quantity at this point
Thank you

That rings a bell.
anotherJEK is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:59 AM.


Advertisement
Log in to turn off these ads.