Last active
February 10, 2020 09:47
-
-
Save itogen/14850489e0aeaaa57872822053e8aaa0 to your computer and use it in GitHub Desktop.
【PHPなど】エルビス演算子 ?: 本当にエルビス・プレスリーだった【画像あり】 ref: https://qiita.com/ito_gen/items/7650454fbb27baefc1f7
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
$hoge = isset($_GET['hoge']) ? $_GET['hoge'] : null; |
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
$hoge = $_GET['hoge'] ?? null; |
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
$hoge = $_GET['hoge'] ?: null; | |
// ↑ 同じ動き ↓ | |
if ($_GET['hoge']) ? $_GET['hoge'] : null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment