Reputation: 4596
I have a custom ini file with configurations (does not refer to php ini file) and i need to check it's syntax. Found a function parse_ini_file
which parses the file, but it generates warning if file is bad, may be there is some function to check if before parse?
Upvotes: 2
Views: 1529
Reputation: 18584
As anticipated in my comment, I would go this way:
function valid_ini_file($path) {
return @parse_ini_file($path) !== false;
}
clear and concise.
Upvotes: 3