Computing.Net > Forums > Web Development > PHP: array to string?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

PHP: array to string?

Reply to Message Icon

Name: jb60606
Date: May 10, 2007 at 12:31:27 Pacific
OS: Suse 10
CPU/Ram: 1Ghz/512MB
Product: HP Vectra
Comment:

Lets say I want to get the contents of a simple array:

$arr = array(“A”, “B”, “C”, “D”);

Into a string, with each element seperated by a "+", preferably with no trailing "+".

Is there any kind of function out there that will help me do this?

Better yet, is there a function for sorting strings?



Sponsored Link
Ads by Google

Response Number 1
Name: jb60606
Date: May 10, 2007 at 12:32:23 Pacific
Reply:

Forgot to leave the string.

$string = "A+B+C+D";


0

Response Number 2
Name: Laler
Date: May 10, 2007 at 13:10:11 Pacific
Reply:

$string = implode ('+', $arr);

www.php.net/implode

---
Fubar


0

Response Number 3
Name: jb60606
Date: May 10, 2007 at 14:27:04 Pacific
Reply:

awesome, thanks


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: PHP: array to string?

xml to string conversion prob www.computing.net/answers/webdevel/xml-to-string-conversion-prob/3396.html

PHP arrays and MySQL www.computing.net/answers/webdevel/php-arrays-and-mysql-/3684.html

error - php file to download pdf. www.computing.net/answers/webdevel/error-php-file-to-download-pdf/3828.html