Home Tutorial Php Phpfiles PHP function parse_ini_file() and example

 
 

Share on Google+Share on Google+
PHP function parse_ini_file() and example
Posted on: October 30, 2009 at 12:00 AM
Advertisement
In this part of the tutorial we will learn about the function parse_ini_file() in context of file handling. And also we will see the example related to the parse_ini_file() function

Syntax of PHP parse_ini_file() Function

  • It is used to parse ini file.ini.
  • file.ini is configuration file
  • After parsing it returns the settings of the ini file in array form


PHP parse_ini_file() Function with Example

Code For PHP parse_ini_file() Function

make a sample.ini with the content 

name = roseindia
domain= net
[second_section]
path = "/usr/local/bin"
URL = "http://www.roseindia.net"
[third_section]
phpversion[] = "5.0"
phpversion[] = "5.1"
phpversion[] = "5.2"
phpversion[] = "5.3"

<?php
    $ar1
=parse_ini_file("sample.ini");
    foreach
($ar1 as $k=>$v)
      echo
$k."->".$v."<br/>";
?>

Output
name->roseindia
domain->net
path->/usr/local/bin
URL->http://www.roseindia.net
phpversion->Array

Advertisement

Related Tags for PHP function parse_ini_file() and example :


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 30, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com