class foo
{
protected $bar = 'qwerty';
public function __get($name)
{
if ('bar' === $name) return $this->bar;
return 'not found';
}
public function __set($property, $value)
{
if ('bar' === $property) $this->bar = $value;
}
}
$f = new foo();
echo $f->bar; // qwerty
echo $f->asd; // not found
$f->bar = 'zxc';
echo $f->bar; // zxc
$input = ['входящий массив', 'например ваш'];
$output = array_filter($input, function ($str) {return false !== stripos($str, 'например');});
print_r($output);
UPDATE linestatuslog s, (SELECT * FROM linestatuslog ORDER BY startDate) n
SET s.endDate = n.startDate
WHERE n.line = s.line AND n.startDate > s.startDate
SELECT t1.name, UNIX_TIMESTAMP(t1.create_time) - UNIX_TIMESTAMP(t2.create_time) as second -- время между событиями в секундах
FROM ticket_history t1
INNER JOIN ticket_history t2 ON t2.ticket_id = t1.ticket_id AND t2.hystory_type_id=2 -- открытие тикета
WHERE t1.hystory_type_id=15 -- закрытые тикеты
SELECT order_id, COUNT(*) as cnt
FROM markers
WHERE m_id IN (10, 20, 30)
GROUP BY order_id
HAVING cnt=3 -- тут количество искомых параметров 10, 20, 30