<?php
$a=array("Volvo"=>"XC90","BMW"=>"X5");
if (array_key_exists("Volvo",$a))
{
echo "Key exists!";
}
else
{
echo "Key does not exist!";
}
?>
<?php
$a=array("Volvo"=>"XC90","BMW"=>"X5","Toyota"=>"Highlander");
print_r(array_keys($a));
?>
<?php
function get_cars($obj) {
if (!is_object($obj)) {
return false;
}
return $obj->cars;
}
$obj = new stdClass();
$obj->cars = array("Volvo", "BMW", "Audi");
var_dump(get_cars(null));
echo "<br>";
var_dump(get_cars($obj));
?>
insert
query
For example:
INSERT INTO `topwords` (`id`, `word`, `frequency`, `deleted`) VALUES
(1, 'the', 22038615, 0),
(2, 'be', 12545825, 0)
...
2) Add SQL file in a public folder or App/someFolderForSQLFiles
3) Use this in seeder
$path = base_path('public\topwords.sql');
$sql = file_get_contents($path);
DB::unprepared($sql);
Or this:
$path = 'app/someFolderForSQLFiles/topwords.sql';
DB::unprepared(file_get_contents($path));
...upstream sent too big header while reading response header from upstream...
Is fixed by adding these lines:fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
To the site's configuration file:server {
listen 80;
server_name pm.use.ge;
root /var/www/pm.use.ge/public_html;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params; > deny all;
}
}
So that the final configuration file looks like this:server {
listen 80;
server_name pm.use.ge;
root /var/www/pm.use.ge/public_html;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_buffers 8 16k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 32k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include fastcgi_params; > deny all;
}
}
(or|and|(?:(?P<case1namE>)\() ?|) ?\w*(\.)?colz( like| ?\=) ?\?(?:(?P=case1namE) OR)?( and)?
in this case if (
is found before the expression then OR
will be captured at the end of the expression(if found)
IMPORTANT: group name is case sensitive
//see code for real example__call()
, whereas is_callable()
does:
<?php
class Test {
public function explicit( ) {
// ...
}
public function __call( $meth, $args ) {
// ...
}
}
$Tester = new Test();
var_export(method_exists($Tester, 'anything')); // false
var_export(is_callable(array($Tester, 'anything'))); // true
?>
$font-weights: (
"regular": 400,
"medium": 500,
"bold": 700
);
//now if we want to apply it we have to use 'map-get' function
body {
font-weight: map-get($font-weights, "medium");
}
.some-class{
font-weight: map-get($font-weights, "bold")
}