0

Right now dates might look something like this 04/18/11 or this 04/08/11.

Well, what needs to be changed and where to not display preceeding 0's in single digit months / days so 04/18/11 becomes 4/18/11 and 04/08/11 would become 4/8/11.. Ty for your time and help.

<?php

$ndnews = file_get_contents('http://www.naughtydog.com/index.php/site/tickerData');

preg_match_all("/<div class=\"message\">\n(.+?)\n<\/d/", $ndnews, $news); 
foreach($news[1] as $item) {
    $Items = explode("  ", $item);
  echo "<span class=\"message\">" . $Items[0] . " - " . $Items[1] . "</span><br />\n"; 
}

?>

Edit: Right now as it stands $Items[0] are the date figures.

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by MoreBloodWine
0

try:

<?php

$ndnews = file_get_contents('http://www.naughtydog.com/index.php/site/tickerData');

preg_match_all("/<div class=\"message\">\n(.+?)\n<\/d/", $ndnews, $news); 
foreach($news[1] as $item) {
    $Items = explode("  ", $item);
  echo "<span class=\"message\">" . preg_replace('#0(\d)/#','$1/',$Items[0]) . " - " . $Items[1] . "</span><br />\n"; 
}

?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.