Skip to content

Instantly share code, notes, and snippets.

@alherd-by
Created September 25, 2017 16:44
Show Gist options
  • Save alherd-by/cfd22edcaf1c2fca9d611093b646a34a to your computer and use it in GitHub Desktop.
Save alherd-by/cfd22edcaf1c2fca9d611093b646a34a to your computer and use it in GitHub Desktop.
<?php
$string = 'string';
$double = 12.12345;
$array = ['foo', 'bar'];
$a = 555;
$b = 'ZZZ';
var_dump(@($a + $b));
var_dump($a . $b);
$staff = [
[
'name' => 'Иванов',
'email' => 'ivanov@domain.com',
'phone' => '111-22-33'
],
[
'name' => 'Петров',
'email' => 'petrov@domain.com',
'phone' => '112-24-36,'
],
[
'name' => 'Сидоров',
'email' => 'petrov@domain.com',
'phone' => '113-25-37'
]
];
$temp = [1, 2, 'A', 3.764, 34, 'B', 12];
$temp = array_filter($temp, function ($value) {
return is_numeric($value);
});
var_dump($temp);
echo '<table style="width: 300px">';
$n = 0;
$red = 0x00;
$green = 0x00;
$blue = 0x00;
foreach (range(0, 1000) as $value) {
$red++;
$green++;
$blue++;
if ($red == 256) {
$red = 0;
$green = 0;
$blue = 0;
}
$colorValue = $red < 16
? "#0" . dechex($red) . "0" . dechex($green) . "0" . dechex($blue)
: "#" . dechex($red) . dechex($green) . dechex($blue);
echo sprintf('<tr bgcolor="%s">', $colorValue);
for ($td = 1; $td <= 3; $td++) {
echo '<td>';
if ($td == 1) {
echo $n;
$n++;
}
echo "</td>";
}
echo "</tr>";
}
echo '</table>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment