This discussion is now closed.
$filearr = explode(".",$fullfilename);
$filewithoutextension = $filearr[0];
$length=strlen($fullfilename); //gets the length of the full filename so you can tell substr when to stop
$filewithoutextension = substr($fullfilename,0,$fullfilename-4);
$filearr = explode(".",$fullfilename);
$filewithoutextension = $filearr[0];
$filearr = explode(".",$fullfilename,-1)
$filenamewithoutext = implode($filearr,".")
$positionOfLastDot = strrpos($fullfilename,".")
$filenamewithoutext = substr($fullfilename,0,$positionOfLastDot)
function sortbyctime (&$array) {
$array = array_flip($array);
foreach ($array as $filename => &$number) {
$number = filectime($filename);
}
arsort($array);
$array = array_keys($array);
}
function sortbyctime (&$array) {
$array = array_flip($array);
foreach ($array as $filename => &$number) {
$number = filectime($filename);
}
arsort($array);
$array = array_keys($array);
}
<?php
function sortbyctime (&$array) {
$array = array_flip($array);
foreach ($array as $filename => &$number) {
$number = filectime($filename);
$date[] = $number;
}
arsort($array);
$array = array_keys($array);
}
$dir = 'Ogaden';
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
$filename = $dir.'/'.$filename;
if(is_file($filename)){
$filename = basename($filename);
$files[] = $filename;
}
}//sort
sortbyctime($files);
for($i=0; $i<sizeof($files); $i++){
$names = explode(".", $files[$i]);
?>
<b><a href="http://www.ogaden.info/Ogaden-News.php?news=<?php echo $files[$i]; ?>"><?php echo $names[0]; echo $date[$i]; ?></a></b><br>
<?php } closedir($dh); ?>
#!/usr/bin/php
<?php
function dir_list ($path) {
$array = scandir($path);
unset($array[0]); // remove .
unset($array[1]); // remove ..
$array = array_flip($array);
foreach ($array as $filename => &$number) {
$number = filectime($path .'/'. $filename);
}
arsort($array);
return $array;
}
$dir = 'exampledir';
$list = dir_list($dir);
foreach ($list as $filename => $epoch) {
if (!is_file($dir .'/'. $filename)) {
continue;
}
printf(
'<b><a href="http://www.ogaden.info/Ogaden-News.php?news=%s">%s (%s)</a></b><br />'."\n",
$dir .'/'. $filename,
substr($filename, 0, strrpos($filename, '.')),
gmdate('Y-m-d H:i:s', $epoch)
);
}
?>
<b><a href="http://www.ogaden.info/Ogaden-News.php?news=exampledir/newer.txt">newer (2007-07-27 14:27:09)</a></b><br />
<b><a href="http://www.ogaden.info/Ogaden-News.php?news=exampledir/file.txt">file (2007-07-27 14:24:18)</a></b><br />
for($i=0; $i<sizeof($files); $i++){
Last reply 3 weeks ago
University blocked ethernet because of personal routerLast reply 4 weeks ago
How do you know if someone's account got hacked or suspended???Last reply 1 month ago
Do you mind foreigners posting stuff in their language on social media?Last reply 4 months ago
My family say I’m stupid for not wanting to spend more than £1.1k on a laptop