class Point {
public $x, $y;
function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
function distanceTo(Point $point) {
$distanceX = $this->x - $point->x;
$distanceY = $this->y - $point->y;
$distance = sqrt($distanceX * $distanceX + $distanceY * $distanceY);
return $distance;
}
function __toString() {
return 'x: ' . $this->x . ', y: ' . $this->y;
}
}
$a = new Point(0, 0);
$points = array(new Point(0, 2), new Point(0.5, 0.3), new Point(1, 1), new Point(-1, -2));
$curNearestPoint = $points[0];
$curNearestDistance = $a->distanceTo($curNearestPoint);
foreach ($points as $point) {
$distance = $a->distanceTo($point);
if ($distance < $curNearestDistance) {
$curNearestDistance = $distance;
$curNearestPoint = $point;
}
}
echo 'nearest point: ' . $curNearestPoint;
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
$spreadsheet->setActiveSheetIndex(0);
$activeSheet = $spreadsheet->getActiveSheet();
use DocxMerge\DocxMerge;
$dm = new DocxMerge();
$dm->merge( [
"templates/TplPage1.docx",
"templates/TplPage2.docx"
], "/tmp/result.docx" );
$date = new DateTime('27.11.2018 21:20');
echo $date->format('Y-m-d H:i:s') . "\n";//27.11.2018 21:20
$date->sub(new DateInterval('PT35M'));
echo $date->format('Y-m-d H:i:s') . "\n"; //27.11.2018 20:45
if(date('H') >= 20 && date(i) >=45 )
{
//ссылка активна
}
class Foo{
public static function changeTest()
{
static::$test = '321';
}
}
class Bar extends Foo
{
public static $test = 123;
}
var_dump(Bar::$test);
Bar::changeTest();
var_dump(Bar::$test);
<input type="hidden" name="data[name][]" value="data1" />
<input type="hidden" name="data[value][]" value="20" />
<input type="hidden" name="data[count][]" value="1" />
<input type="hidden" name="data[name][]" value="data2" />
<input type="hidden" name="data[value][]" value="30" />
<input type="hidden" name="data[count][]" value="2" />
<input type="hidden" name="data[0][name]" value="data1" />
<input type="hidden" name="data[0][value]" value="20" />
<input type="hidden" name="data[0][count]" value="1" />
<input type="hidden" name="data[1][name]" value="data2" />
<input type="hidden" name="data[1][value]" value="30" />
<input type="hidden" name="data[1][count]" value="2" />