This commit is contained in:
boris
2025-02-06 12:30:01 +00:00
parent f30a8fe711
commit f64a9eadbe
176 changed files with 21418 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
<?php
for ($i = 128512; $i < 128592; $i++) {
$hex = dechex($i);
echo "Icon for 0x$hex is '&#x$hex'";
echo "<br>";
}

View File

@@ -0,0 +1,33 @@
<?php
$temp = array(78, 60, 62, 68, 71, 68, 73, 85, 66, 64, 76, 63, 75, 76, 73, 68, 62, 73, 72, 65, 74, 62, 62, 65, 64, 68, 73, 75, 79, 73);
function smallestTemp($temp)
{
sort($temp, SORT_NATURAL);
for ($i = 0; $i < 7; $i++) {
$smallestTemp[$i] = $temp[$i];
}
return implode(", ", $smallestTemp);
}
function largestTemp($temp) {
rsort($temp, SORT_NATURAL);
for ($i = 0; $i < 7; $i++) {
$largestTemp[$i] = $temp[$i];
}
return implode(", ", $largestTemp);
}
function calcAvgTemp($temp) {
$totalTemp = 0;
foreach ($temp as $value) {
$totalTemp += $value;
}
return round( ($totalTemp / count($temp) ), 1 );
}
echo "Average Temperature is : " . calcAvgTemp($temp);
echo "<br>";
echo "List of seven lowest temperatures : " . smallestTemp($temp);
echo "<br>";
echo "List of seven highest temperatures : " . largestTemp($temp);

View File

@@ -0,0 +1,47 @@
<html lang="en">
<head>
<title>Train Listings</title>
</head>
<body>
<table>
<tr>
<th>Title</th>
<th>Price</th>
</tr>
<?php
#error_reporting(0);
$url = "https://www.classifiedsteam.co.uk/index.php?page=search&sCategory=10";
$string = file_get_contents($url);
$dom = new DOMDocument();
$dom->loadHTML($string);
$xpath = new DOMXPath($dom);
$titles = $xpath->query("//a[contains(@class, 'title')]");
$prices = $xpath->query("//span[contains(@class, 'currency-value')]");
for ($i=0; $i<$titles->length; $i++) {
$title = $titles->item($i)->textContent;
$link = $titles->item($i)->getAttribute('href');
$price = $prices->item($i)->textContent;
echo "<tr>\n";
echo "<td><a href='$link' title='$title'>$title</a></td>\n";
echo "<td>$price</td>\n";
echo "</tr>\n";
}
?>
</table>
</body>
<style>
html {
font-family: "DejaVu Sans";
}
table, td, th {
border: 1px solid;
border-collapse: collapse;
}
td, th {
padding: 8px 6px 8px 6px;
}
a {
text-decoration: none;
}
</style>
</html>