Dynamic Array using glob?


Posted on 16th Feb 2014 07:03 pm by admin

Is there an easier way to do this?

I am trying to get create a dyamic array based on files within the folder.

Did you know?Explore Trending and Topic pages for more stories like this.
Code: foreach (glob("*.jpg") as $filename) {
$items = array("title" => $filename)
}

$output = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$output .= '<rss version="2.0">';
$output .= "<channel>";
$output .= "<title>" . $channel["title"] . "</title>";
$output .= "<description>" . $channel["description"] . "</description>";
$output .= "<link>" . $channel["link"] . "</link>";
$output .= "<copyright>" . $channel["copyright"] . "</copyright>";

foreach ($items as $item) {
$output .= "<item>";
$output .= "<title>" . $item["title"] . "</title>";
$output .= "</item>";
}
$output .= "</channel>";
$output .= "</rss>";

header("Content-Type: application/rss+xml; charset=ISO-8859-1");
echo $output;
?>
No comments posted yet

Your Answer:

Login to answer
216 Like 32 Dislike
Previous forums Next forums
Other forums

Do While statement
hi guys,

This may sound trivial but im new to php and as part of an assignmenti have to const

phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:

Code: [Select]$mailer = new PHPMailer();
$mailer-&

Sendmail.php - heading error following check_input
Hi,

I would greatly appreciate some help? I am brand new to PHP and have been searching and e

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

PRotect my POST DATA... FROM HTML ATTACKS
I need to like let's say

If a user submit's his Prayer and he put's <meta refresh stuf

Automatically Detect Phone Model for WAP Jar Deployment
Making a wap site is fairly simple, but I'd like to know if there's a way to make it so that the wap

update sql when refresh - php
hi
I have made a table (attachement)

the users can update the sql database using + or x bu

$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash