Forum Moderators: coopster
<?php
ini_set('error_reporting', 8191);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
$currentfile = date('s');
$allfiles = array();
$allfiles[1] = "thisfile.txt";
$allfiles[2] = "thatfile.html";
$allfiles[3] = "thatfile.gif";
$allfiles[4] = "thisfile.txt";
$allfiles[5] = "thatfile.html";
$allfiles[6] = "thatfile.gif";
if (in_array(".gif",$allfiles))
{echo '<img src="'.$allfiles[$currentfile].'">';}
else {$get_content = file_get_contents($allfiles[$currentfile]);
echo $get_content;}
?>
Maybe someone can tell me why this one won't work then. Says undefined index on these two lines. Can anyone see why this isn't working? Thanks. [1][edited by: Simone100 at 9:03 am (utc) on Aug. 24, 2007]
if (in_array(substr($allfiles[$currentfile], -3), array('gif','jpg','png')))
else { $get_content = file_get_contents($allfiles[$currentfile]);
and whole code.
<?php
ini_set('error_reporting', 8191);
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
$currentfile = date('s');
$allfiles = Array();
$allfiles[1] = "thisfile.txt";
$allfiles[2] = "thatfile.html";
$allfiles[3] = "thatfile.gif";
$allfiles[4] = "thisfile.txt";
$allfiles[5] = "thatfile.html";
$allfiles[6] = "thatfile.gif";
if (in_array(substr($allfiles[$currentfile], -3), array('gif','jpg','png')))
echo '<img src="'.$allfiles[$currentfile].'">';
else { $get_content = file_get_contents($allfiles[$currentfile]);
echo $get_content;}
?>
I tried adjusting the quotations but fouled it up worse and I don't understand why it wants a paranthesis there, seems like the brackets like you have it should be the way.
[edited by: Simone100 at 7:46 am (utc) on Aug. 30, 2007]