Skip to content

Instantly share code, notes, and snippets.

@houssemz
Last active June 28, 2018 10:48
Show Gist options
  • Save houssemz/20a807623f03cb258bb7ce344245b0b8 to your computer and use it in GitHub Desktop.
Save houssemz/20a807623f03cb258bb7ce344245b0b8 to your computer and use it in GitHub Desktop.
Tips that can come as question in PHP certification

🚫 Functions names are case-insensitive !

<?php

define('CONSTANT', 1);
define('_CONSTANT', 0);
define('EMPTY', '');

if (!empty(EMPTY)) {
    # ...
} elseif (constant('CONSTANT')) {
    # ...
}

// user function
function my_func()
{
    echo 'Je suis une mouche';
}

MY_FUNC();

# This code will produce Parse error because empty() === EMPTY()

BUT 🚫 variables names are case-insensitive !

<?php
$var = 'my var';
echo $VAR, PHP_EOL; // Notice: Undefined variable: VAR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment