class App
{
protected $data = [];
public function setData(array $data)
{
$this->data = $data;
}
}
class ModulOne extends App
{
public $id;
public function setData(array $data)
{
parent::setData($data);
if (!empty($this->data['id'])) {
$this->id = $this->data['id'];
}
}
}
$a = new ModulOne();
$a->setData(['id' => 1]);
var_dump($a);
bcdiv('12.345', 1, 2); // 12.34
function getUrlLanguage($defaultLanguage = 'ru', $allowedLanguages = ['ru', 'en']) {
$urlLanguage = $defaultLanguage;
$urlPath = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if ($urlPath) {
$urlPathExploded = explode('/', $urlPath);
if (in_array($urlPathExploded['1'], $allowedLanguages)) {
$urlLanguage = $urlPathExploded['1'];
}
}
return $urlLanguage;
}
$currentLocalizeUrl = sprintf(
"%s://%s%s%s",
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http',
$_SERVER['SERVER_NAME'],
"en",
$_SERVER['REQUEST_URI']
);
// Массив данных
$arr = [];
// Текущее время
$currentTime = date("H:i");
// Проверка на наличие данных для текущего времени
if (array_key_exists($currentTime, $arr)) {
// Отображаем данные
print_r($arr[$currentTime]));
}
$attribute_name = 'body_'.$lang;
$model->$attribute_name = implode($body);
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$email_md5 = basename($url); // C93D3BF7A7C4AFE94B64E30C2CE39F4F
$(document).ready(function() {
var params = window.location.search.replace(/\+/g, '%20');
$('a').each( function(i) {
if (this.href.indexOf('?') == -1) {
this.href = this.href + params;
} else if (params.length) {
this.href = this.href + '&' + params.substr(1);
}
});
});