We help IT Professionals succeed at work.
Get Started

implode array in php

CalmSoul
CalmSoul asked
on
242 Views
Last Modified: 2015-03-03
I have following array ... I am trying to implode it but having difficulties

require 'parserss.class.php'; 
// Second step, create new object 
$ob = new ParseRSS;
$example_ = $ob->parse('http://www.espncricinfo.com/rss/content/feeds/news/6.xml'); 

print_r($example_); 

//echo "'" . implode("','",$example_[items] => Array) . "'";


echo implode(', ', array_map(function ($entry) {
  return $entry['title'];
}, $example_));

Open in new window


I want to get this out put

[title] => BCCI power triangle leaves question mark over control
                    [description] => When the dust had settled on the BCCI elections, one thing was clear: the board would no longer be controlled by one man or group
                    [link] => http://www.espncricinfo.com/india/content/story/842031.html?CMP=OTC-RSS
                    [author] => 
                    [category] => 
                    [comments] => 
                    [enclosure] => 

Open in new window



Array:


Array
(
    [xml_version] => 1.0
    [xml_encoding] => UTF-8
    [rss_version] => 2.0
    [channel] => Array
        (
            [title] => India news from ESPN Cricinfo.com
            [description] => Visit Cricinfo.com for up-to-the-minute cricket news, breaking cricket news, live cricket commentary, ball-by-ball commentary, cricket video, cricket audio and features.
            [link] => http://www.espncricinfo.com
            [copyright] => (c)Cricinfo
            [managingEditor] => 
            [webMaster] => 
            [pubDate] => Mon, 02 Mar 2015 22:27:55 GMT
            [lastBuildDate] => 
            [category] => 
            [generator] => 
            [docs] => 
            [ttl] => 2
            [skipHours] => 
            [skipDays] => 
        )

    [image] => Array
        (
            [title] => India news from ESPN Cricinfo.com
            [description] => 
            [link] => http://www.espncricinfo.com/
            [url] => http://i.imgci.com/espncricinfo/espnci.png
            [width] => 
            [height] => 
        )

    [items] => Array
        (
            [0] => Array
                (
                    [title] => BCCI power triangle leaves question mark over control
                    [description] => When the dust had settled on the BCCI elections, one thing was clear: the board would no longer be controlled by one man or group
                    [link] => http://www.espncricinfo.com/india/content/story/842031.html?CMP=OTC-RSS
                    [author] => 
                    [category] => 
                    [comments] => 
                    [enclosure] => 
                    [guid] => http://www.espncricinfo.com/india/content/story/842031.html
                    [pubDate] => Mon, 02 Mar 2015 22:27:55 GMT
                )

            [1] => Array
                (
                    [title] => BCCI elections to be challenged in court
                    [description] => The BCCI's twice deferred election is set to be challenged in the Bombay High Court on Tuesday over the decision to allow the Baroda Cricket Association president Samarjit Sinh Gaekwad to represent the BCA in the election
                    [link] => http://www.espncricinfo.com/india/content/story/841963.html?CMP=OTC-RSS
                    [author] => 
                    [category] => 
                    [comments] => 
                    [enclosure] => 
                    [guid] => http://www.espncricinfo.com/india/content/story/841963.html
                    [pubDate] => Mon, 02 Mar 2015 15:14:01 GMT
                )

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2020
Most Valuable Expert 2018
Commented:
This problem has been solved!
Unlock 2 Answers and 17 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE