Solved

string function question

Posted on 2006-11-03
2
188 Views
Last Modified: 2006-11-18
$row_dati['classi']  

contains a string like

"1ABIENNIO,1ALST,1BBIENNIO,1BLST,1CBIENNIO,1CLST,1DBIENNIO,1DLST,1EBIENNIO,1ELST,1GBIENNIO"

i need to put a space after the comma ...

1ABIENNIO, 1ALST, 1BBIENNIO, 1BLST, 1CBIENNIO, 1CLST, 1DBIENNIO, 1DLST, 1EBIENNIO, 1ELST, 1GBIENNIO


how do i do that?
0
Comment
Question by:floyd0987
  • 2
2 Comments
 
LVL 30

Accepted Solution

by:
callrs earned 500 total points
ID: 17870833
<?php
$str="1ABIENNIO,1ALST,1BBIENNIO,1BLST,1CBIENNIO,1CLST,1DBIENNIO,1DLST,1EBIENNIO,1ELST,1GBIENNIO";
$str=explode(",",$str);
$str=implode(", ",$str);
echo $str;
?>
0
 
LVL 30

Expert Comment

by:callrs
ID: 17920230
Thanks.

Might be better to use separate variables:
$strArray=explode(",",$str);
$str=implode(", ",$strArray);
echo $str;
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What's wrong with this PDO query? 5 27
php help 34 58
Wordpress Pagination 1 28
Force PDF to open inline as opposed to dowload 16 22
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question