Re: [Pro. PHP Dev.] split the word after coma(,)

2 views
Skip to first unread message
Message has been deleted

Robert Gonzalez

unread,
Aug 25, 2010, 2:28:41 PM8/25/10
to professi...@googlegroups.com
Let's start with baby steps... you want to be able to split a string on a character? Like by using one of the following functions:

split()
preg_split()
explode()

For known size splits, you might want to look into:
str_split()
chunk_split()

And for reference, a google search for splitting a string on a string using PHP would have probably turned these up faster than asking us to do the search for you. You might have even gotten use cases and examples from blog posts and such.


On Wed, Aug 25, 2010 at 11:21 AM, shankar <shankar...@gmail.com> wrote:
hi friends........
       i need find a solution for my problem help me..  in the form
form i am adding some list of data from the field to the database in
that i am adding some data with adding coma(,). i am displaying the
data from the database in a page. while displaying i need to split the
words which comes after coma(,) and the spited word should be in a
html linked...

--
This group is managed and maintained by the development staff at 360 PSG. An enterprise application development company utilizing open-source technologies for todays small-to-medium size businesses.

For information or project assistance please visit :
http://www.360psg.com

You received this message because you are subscribed to the Google Groups "Professional PHP Developers" group.
To post to this group, send email to Professi...@googlegroups.com
To unsubscribe from this group, send email to Professional-P...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Professional-PHP

Néstor

unread,
Aug 25, 2010, 2:29:01 PM8/25/10
to professi...@googlegroups.com
I am splitting a ling od data that contains 4 fields, I use this code to do so:
      list($f1,$f2,$f3,$f4) = explode(',', $line, 4);

I hope this helps  :-)
Message has been deleted

Robert Gonzalez

unread,
Aug 25, 2010, 3:16:49 PM8/25/10
to professi...@googlegroups.com
So make it happen in your output. You know HTML right? Use your HTML skillz to make links for those words.

On Wed, Aug 25, 2010 at 11:43 AM, shankarlingaraj <shankar...@gmail.com> wrote:

      now only i say the functions. their is 2 set of task in that.spiting is not the only thing i need to do i wand to put all the spited words in a html link

example:
   word , letter, house   i need this to happen in the out put

--
SHANKARLINGARAJ

bradleylamar

unread,
Aug 26, 2010, 11:55:33 AM8/26/10
to Professional PHP Developers
Please don't use split(). It's deprecated and will cause your code not
to be portable or future-proofed.
I often use a method like Nestor listed.

On Aug 25, 1:28 pm, Robert Gonzalez
<robert.anthony.gonza...@gmail.com> wrote:
> Let's start with baby steps... you want to be able to split a string on a
> character? Like by using one of the following functions:
>
> split() <http://php.net/split>
> preg_split() <http://php.net/preg_split>
> explode() <http://php.net/explode>
>
> For known size splits, you might want to look into:
> str_split() <http://php.net/str_split>
> chunk_split() <http://php.net/chunk_split>
Reply all
Reply to author
Forward
0 new messages