I want to go jogging tomorrow.
I was looking for options to store a configuration file, and while JSON or YAML are getting more tractions becaues they provide more flexibility, INI files still serve the purpose.
An INI file is a plain text file commonly used in computing and programming to store configuration settings for software applications. It is a simple and widely supported format that organizes information into sections and key-value pairs[1].
INI files are commonly used to store application-specific settings, such as database connection details, user preferences, interface configurations, and more. They provide an easy-to-read and editable format for storing and retrieving configuration data. Many programming languages have built-in functions or libraries to parse and manipulate INI files[1].
[1] Understanding the Basics of an Initialization File [2] INI file - Wikipedia [3] What is an INI file? Here's how to create, open and edit an INI file
PHP: The configuration file - Manual
The configuration file (php.ini) is read when PHP starts up. For the server module versions of PHP, this happens only once when the web server is started. For the CGI and CLI versions, it happens on every invocation.
Example #2 php.ini example
; any text on a line after an unquoted semicolon (;) is ignored
[php] ; section markers (text within square brackets) are also ignored
; Boolean values can be set to either:
; true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes
; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"
; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"
configparser
- Configuration file parserconfigparser - Configuration file parser
This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what’s found in Microsoft Windows INI files. You can use this to write Python programs which can be customized by end users easily.
I don't see many real-life examples these days, as it just stores key-value pairs. For example, if I want to set a list of values to a key, I need to add some logic on the program side. Thinking about supporting complex configuration, using JSON or YAML just feels right.
Total kcal
push-ups
MUST:
TODO: