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

for Example...

Array
(
[0] => status=1&messages=xxxxxxxxx&credit=23.4;
)

i just want to get status = 1

how can i get it..?? help me out...!! :(

Recommended Answers

All 4 Replies

You can use a combination of the substr and strpos functions to achieve this.

you can achive this by using explode function
suppose you have info. in array like
$array[0]
now by using explode function:

$exploded= explode('&',$array[0]);

now $exploded[0] will contain status=1

i hope this helps you.

commented: Good tip, I hadn't thought of using explode like this +4

i thnk explode convert string into array..!!
.
.
but here value itself an array.... does it work.?

Okay i have tested... its working pretty fine with explode..!!!!
.
.
.
thnx maan..!!! :)

$arr = explode("&",$lines[0]);
         print_r($arr[0]);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.