Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Snake Case

Snake case, also written snake_case is a way of writing names without spaces, where:

  • All the letters are set to lower case
  • Each word is separated from the other by an underscore

The underscore letters create humps like a camel’s back: this is the origin of the name.

Snake case is often used for PHP native functions.

<?php

    function to_lower(string $string): int {
        // PHP native function
        return mb_strtolower($string);
    }

?>

Documentation

See Also