note 84348 added to function.parse-ini-file
| From: | juampii_4 at hotmail dot com | Date: | Thu, 10 Jul 2008 03:24:13 +0000 |
| Subject: | note 84348 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141344@lists.php.net to get a copy of this message | ||
class.parseini.php
<?php
##By juan pablo tosso
class Parser
{
public function printini($file, $sector, $var)
{
$file=$file.".ini";
$is=array();
$is= parse_ini_file($file, true);
trim($is);
if(is_array($is) && file_exists($file))
{
return $is[$sector][$var];
}else{
return "error";
}
}
}
?>
Ini.ini:
[test]
foo=bar
[test2]
foo1=bar1
foo2=bar2
foo bar=something else
just in another file write:
include("class.parseini.php");
$new= new Parser();
echo $new->printini("ini", "test2", "foo1");
----
Server IP: 200.24.234.70
Probable Submitter: 200.104.7.21
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- https://master.php.net/note/edit/84348
Del: integrated -- https://master.php.net/note/delete/84348/integrated
Del: useless -- https://master.php.net/note/delete/84348/useless
Del: bad code -- https://master.php.net/note/delete/84348/bad+code
Del: spam -- https://master.php.net/note/delete/84348/spam
Del: non-english -- https://master.php.net/note/delete/84348/non-english
Del: in docs -- https://master.php.net/note/delete/84348/in+docs
Del: other reasons-- https://master.php.net/note/delete/84348
Reject -- https://master.php.net/note/reject/84348
Search -- https://master.php.net/manage/user-notes.php