note 92641 added to function.parse-ini-string

From: Date: Sat, 01 Aug 2009 22:28:21 +0000
Subject: note 92641 added to function.parse-ini-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-158992@lists.php.net to get a copy of this message
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! ---- Server IP: 69.147.83.197 Probable Submitter: 71.214.127.218 ---- Manual Page -- http://www.php.net/manual/en/function.parse-ini-string.php Edit -- https://master.php.net/note/edit/92641 Del: integrated -- https://master.php.net/note/delete/92641/integrated Del: useless -- https://master.php.net/note/delete/92641/useless Del: bad code -- https://master.php.net/note/delete/92641/bad+code Del: spam -- https://master.php.net/note/delete/92641/spam Del: non-english -- https://master.php.net/note/delete/92641/non-english Del: in docs -- https://master.php.net/note/delete/92641/in+docs Del: other reasons-- https://master.php.net/note/delete/92641 Reject -- https://master.php.net/note/reject/92641 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#158992) next »