Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP parse_ini_file() Function.
The PHP parse_ini_file() function parses a configuration (ini) file.
The PHP parse_ini_file() function parses a configuration (ini) file.
Syntax
Following below is the syntax to use this function -
array parse_ini_file ( string $filename [, bool $process_sections = FALSE [, int $scanner_mode = INI_SCANNER_NORMAL ]] )
READ: PHP | lstat() Function
This function loads in the ini file specified in a filename and returns the settings in an associative array. The structure of an ini file is the same as the php.ini's.
Return Value
This built-in function returns the settings in an associative array.
Example1
Try out the below example -
<?php print_r(parse_ini_file("/PhpProject/simple.ini")); ?>
Output
When the above code is executed, it will produce the following result -
Array ( [me] => Kennedy [you] => John [first] => https://www.webdesigntutorialz.com [second] => https://www.google.com )
Example2
Try out the below example -
<?php print_r(parse_ini_file("/PhpProject/simple.ini", true)); ?>
Output
When the above code is executed, it will produce the following result -
Array ( [names] => Array ( [me] => Kennedy [you] => John ) [urls] => Array ( [first] => http://www.webdesigntutorialz.com [second] => https://www.google.com ) )
Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the PHP pathinfo() Function.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.