Home > Backend Development > PHP Tutorial > parse_ini_string() function in PHP

parse_ini_string() function in PHP

WBOY
Release: 2023-09-04 11:38:01
forward
776 people have browsed it

parse_ini_string() function in PHP

parse_ini_string() function parses the configuration string. This function returns an associative array of settings on success. Returns FALSE on failure.

Syntax

parse_ini_string(file_path, process_sections)
Copy after login

Parameters

  • file_path − The ini file to be parsed.

  • process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.

Return

The parse_ini_string() function returns the settings as an associative array on success. It returns FALSE on failure.

Let's say the content of our “demo.ini” is −

[names]
one = Anne
[urls]
host1 = "https://www.example1.com"
Copy after login

Example

<?php
   print_r(parse_ini_string("demo.ini"));
?>
Copy after login

Output

Array
(
[one] => Anne

[host1] => https://www.example1.com
)
Copy after login

The above is the detailed content of parse_ini_string() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template