This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// before | |
0 == 'foobar' // true | |
// after | |
0 == 'foobar' // false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
case '8.0': | |
$result = "Oh no!"; | |
break; | |
case 8.0: | |
$result = "This is what I expected"; | |
break; | |
} | |
echo $result; | |
//> Oh no! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function doMath(int|float): int|float | |
{ | |
// ... | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// before | |
array_fill(0, 100, 50); | |
// after | |
array_fill(start_index: 0, count: 100, value: 50); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Attribute; | |
class UserController | |
{ | |
#[Route('api/users', ['Methods' : ['GET']])] | |
public function getUsers() | |
{ | |
// ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/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']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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)}; |