PHP
php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
function starts_with($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
function ends_with($haystack, $needle)
{
$length = strlen($needle);
return $length === 0 ||
(substr($haystack, -$length) === $needle);
}
/**
* Classe per gestire la formattazione di date e numeri in convenzioni differenti.
*/
class Formatter
{
protected static $standards = [
'timestamp' => 'Y-m-d H:i:s',
'date' => 'Y-m-d',
'time' => 'H:i:s',
'number' => [
'decimals' => '.',
'thousands' => '',
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run