Reputation: 5762
I am paring some .ini files via PHP
ini file looks like:
07=TEXT1
93=TEXT2
00=TEXT3
01=TEXT4
83=TEXT5
Some simple script to print value if you know offset will loooks like
public function pasrseString($path)
{
$ini = parse_ini_file($path);
print_r($ini["01"]);
}
Problem is that I don't know what file I give to script in future so I dont know what offset will be there. So I need somehow print both value and offset. In other words: I need some foreach which print result to table like:
id | value
--------|----------
01 | TEXT4
--------|----------
93 | TEXT2
--------|----------
07 | TEXT1
--------|----------
83 | TEXT5
Can someone advise me with this?
Upvotes: 0
Views: 52
Reputation: 339
<?php
foreach($ini as $key => $value) {
echo $key . " = " . $value . "<br />";
}
?>
This will output something like:
93 = TEXT2
07 = TEXT1
83 = TEXT5
Upvotes: 2