$input = 'apple.com/ru';
$host = parse_url($input, PHP_URL_HOST);
if ($input === $host) {
// передан только домен
}
(min-width: 1024px)
(max-width: 1023px)
<input name="answers[]" value="1" type="checkbox" checked>
<input name="answers[]" value="2" type="checkbox">
<input name="answers[]" value="3" type="checkbox" checked>
$_POST['answers']; // [1,3]
<input name="answer" value="1" type="radio">
<input name="answer" value="2" type="radio" checked>
<input name="answer" value="3" type="radio">
$_POST['answer']; // 2
env()
If you execute theconfig:cache
command during your deployment process, you should be sure that you are only calling theenv
function from within your configuration files. Once the configuration has been cached, the.env
file will not be loaded and all calls to theenv
function will returnnull
.
.menu {
display: none;
}
@media (max-width: 600px) {
.menu.open {
display: block;
}
}
const obj = { prop: 123 }
// Это два одинаковых выражения
obj.prop // 123
obj['prop'] // 123
const obj = { prop: 123 }
const name = 'prop';
obj[name] // 123
const my_func = function() {}
// чтобы ее вызвать
my_func();
const obj = {
my_func: function(){}
}
const my_other_func = function() {}
const obj = {
my_func: my_other_func
}
obj.my_func()
obj['my_func']()
// или
const name = 'my_func';
obj[name]()
async function getData() {
const o_btc = await fetch('https://api.coingecko.com/api/v3/coins/bitcoin')
.then(res => res.json());
const o_eth = await fetch('https://api.coingecko.com/api/v3/coins/ethereum')
.then(res => res.json());
$('.demo').html(o_btc.market_data.current_price.rub / o_eth.market_data.current_price.rub);
}
getData();
<input type="checkbox" name="check" value="1">
$request->validate([
'check' => 'sometimes|bool',
]);
<input type="hidden" name="check" value="0">
<input type="checkbox" name="check" value="1">
protected function prepareForValidation()
{
$this->merge([
'check' => $this->has('check')
]);
}
expects parameter 1 to be mysqli_result, boolean given