Skip to content

Instantly share code, notes, and snippets.

View paramientos's full-sized avatar
💭
Excel is not a database

Soysal Tan paramientos

💭
Excel is not a database
View GitHub Profile
<?php
// before
0 == 'foobar' // true
// after
0 == 'foobar' // false
<?php
// before
$user = get_user($id);
if (!is_null($user)) {
$address = $user->getAddress();
if (!is_null($address)) {
$state = $address->state;
If (!is_null($state)) {
// And so on.
}
<?php
case '8.0':
$result = "Oh no!";
break;
case 8.0:
$result = "This is what I expected";
break;
}
echo $result;
//> Oh no!
<?php
function doMath(int|float): int|float
{
// ...
}
<?php
// before
array_fill(0, 100, 50);
// after
array_fill(start_index: 0, count: 100, value: 50);
<?php
use \Attribute;
class UserController
{
#[Route('api/users', ['Methods' : ['GET']])]
public function getUsers()
{
// ...
<?php
// PHP 7
class FormRenderer
{
private ThemeSystem $theme;
private UserRepository $users;
private ModuleSystem $modules;
public function __construct(ThemeSystem $theme, UserRepository $users, ModuleSystem $modules) {
$this->theme = $theme;
#/user/local/vesta/web/login/index.php
`<?php
define('NO_AUTH_REQUIRED',true);
// Main include
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
//echo $_SESSION['request_uri'];
<?php
/*************************************/
session_start();
$digit = "6";
function generate_code($digit) {
$random_it="";
$letters = "abcdefghjkmnprstuxvyz23456789ABCDEFGHJKMNPRSTUXVYZ";
for ($i=0; $i<$digit; $i++) {
$salla .= $letters{rand(0,strlen($letters)-1)};