note 92641 deleted from function.parse-ini-string by googleguy

From: Date: Thu, 13 Jun 2013 14:28:38 +0000
Subject: note 92641 deleted from function.parse-ini-string by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-195199@lists.php.net to get a copy of this message
Note Submitter: aldo at mschat dot net ---- If you want to use something like this on a PHP version below that of PHP 5.3, you can emulate it roughly by doing something like this: <?php if(!function_exists('parse_ini_string')) { function parse_ini_string($ini, $process_sections = false, $scanner_mode = null) { # Generate a temporary file. $tempname = tempnam('/tmp', 'ini'); $fp = fopen($tempname, 'w'); fwrite($fp, $ini); $ini = parse_ini_file($tempname, !empty($process_sections)); fclose($fp); @unlink($tempname); return $ini; } } ?> May not be the most efficient way (I suppose you could do some regex stuff instead...) but it certainly works!

« previous php.notes (#195199) next »