943,547 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1406
  • PHP RSS
Jun 1st, 2009
0

[b]How the break data in Array..?? [/b]

Expand Post »
i have some data in an Array but i want only a particular part of it..!!
how can i get it..

for Example...
PHP Syntax (Toggle Plain Text)
  1. Array
  2. (
  3. [0] => status=1&messages=xxxxxxxxx&credit=23.4;
  4. )

i just want to get status = 1

how can i get it..?? help me out...!!
Last edited by peter_budo; Jun 1st, 2009 at 2:31 pm. Reason: Keep It Organized - Avoid using an excessive amount of [bbcode] to alter font styles or to draw more attention to your post.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
nish123 is offline Offline
83 posts
since Apr 2009
Jun 1st, 2009
0

Re: [b]How the break data in Array..?? [/b]

You can use a combination of the substr and strpos functions to achieve this.
Reputation Points: 395
Solved Threads: 192
Veteran Poster
darkagn is offline Offline
1,136 posts
since Aug 2007
Jun 1st, 2009
1

Re: [b]How the break data in Array..?? [/b]

you can achive this by using explode function
suppose you have info. in array like
$array[0]
now by using explode function:
Quote ...
$exploded= explode('&',$array[0]);
now $exploded[0] will contain status=1

i hope this helps you.
Reputation Points: 15
Solved Threads: 6
Junior Poster
navi17 is offline Offline
118 posts
since Oct 2007
Jun 2nd, 2009
0

Re: [b]How the break data in Array..?? [/b]

i thnk explode convert string into array..!!
.
.
but here value itself an array.... does it work.?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
nish123 is offline Offline
83 posts
since Apr 2009
Jun 2nd, 2009
0

Re: [b]How the break data in Array..?? [/b]

Okay i have tested... its working pretty fine with explode..!!!!
.
.
.
thnx maan..!!!
PHP Syntax (Toggle Plain Text)
  1.  
  2. $arr = explode("&",$lines[0]);
  3. print_r($arr[0]);
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
nish123 is offline Offline
83 posts
since Apr 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: CAPTCHA Image error whilst sending form
Next Thread in PHP Forum Timeline: alternative of header..??





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC