How to use property file in php ?

How to use property file in php ?

How to use property file in php ?

What is Property file ?
Property file in php will have the .ini extension. which will be used generally for the constant informations like website_url, filepaths and key, value mappings etc.

Extension:
Its a .ini extension.

Sample Property file:

prop.ini:

Idea=12
Airtel=2
Aircel=1

(or)

Idea=12;
Airtel=2;
Aircel=1;

PHP Code to get the prop(ini file) values by its key:

<?php
$ini_array = parse_ini_file("prop.ini");
$propKey = 'Idea';
echo $ini_array[$propKey];
?>

Output:
12

Download Source code:
Php Property File Source code

Please feel free to post your queries/comments…..

Php Recommended Books:

556 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *