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

Format

Format is a set of rules to structure a piece of text, and make it parsable by a specific engine. A piece of text may be in the format: then, it is usable as a command for another technology.

Formats have various shapes. Here are some examples of formats:

  • SQL Structure Query Language: SELECT column FROM table
  • Date and time: 2020-01-01
  • sprintf(), with %d 9
  • Regular expressions
  • YAML
  • INI
  • CSV
  • JSON

It is possible to define one’s custom format. Common formats have comprehensive specifications, such as how to build them, and assorted tools, to encode, decode, use, combine, etc.

<?php

    // displays 123 with 9 characters, and fills with dots any empty characters
    // ......123
    echo sprintf("%'.9d\n", 123);

?>

Documentation

See Also