<?php
$Re = glob("txt/*.{jpg}", GLOB_BRACE);
foreach ($Re as $filename) {
$uuu = pathinfo($filename, PATHINFO_FILENAME);
$ttt = "txt/$uuu.txt";
$sss = file_get_contents($ttt);
echo "<img src=$filename width='100' height='100'/>";
}
echo $sss;
?>
<?php
$Re = glob("txt/*.{jpg}", GLOB_BRACE);
foreach ($Re as $filename) {
$uuu = pathinfo($filename, PATHINFO_FILENAME);
$ttt = "txt/$uuu.txt";
$sss = file_get_contents($ttt);
echo "<img src=$filename width='100' height='100'/>";
}
echo $sss;
?>
$number = 0;
foreach ($Re as $filename) {
//...
$sss = file_get_contents($ttt);
if ($sss>$number) $number = $sss;
//...
}
echo $number;
<?php
$Re = glob("txt/*.{jpg}", GLOB_BRACE);
$max = array();
foreach ($Re as $filename) {
$uuu = pathinfo($filename, PATHINFO_FILENAME);
$ttt = "txt/$uuu.txt";
$max[] = trim( file_get_contents($ttt) );
echo "<img src=$filename width='100' height='100'/>";
}
echo max( $max );
?>
Цитата (walerus @ 22.03.2013 - 13:12) |
<?php так быстрее ;) |
<?php
error_reporting(E_ALL);
$Re = glob("txt/*.{jpg}", GLOB_BRACE);
$max = array();
foreach ($Re as $filename) {
$uuu = pathinfo($filename, PATHINFO_FILENAME);
$ttt = "txt/$uuu.txt";
$max[ trim( file_get_contents($ttt) ) ] = trim( $uuu . '.txt' );
echo "<img src=$filename width='100' height='100'/>";
}
ksort( $max );
$max_last = end( $max );
$max_element = array_search( $max_last, $max);
echo 'Число => ' . $max_element . ', файл => ' . $max_last ;
?>