php
Using PHP, how can I add quotations to a non-standard INI file?
I'm having to work with a custom application that stores information in an INI formatted file. Unfortunately, it doesn't use double-quotes around all the values, so PHP's parse_ini_file function won't work. Is there some way to add quotations around ALL the values in the INI file so that the parse_ini_file would be able to parse it?
I figured out something that works for me! $lines = file_get_contents('bravo.txt'); $search = array("=", "\r\n"); $replace = array("=\"", "\" ");
Try this: $content = preg_replace('^([^=]+)=\s*(.*)$', '$1="$2"", $fileContent); This should make sure you are not falsely including whitespaces in your values.
Related Links
transform CURL request to PHP CURL
Image-download-script randomly generates corrupt images
How can I change the value of constant in cakephp?
getting all child data from parent controller in cakephp
Should I use all lower case usernames since my pages have error when the username is not case sensitive in URL
Selenium with phpunit error “Undefined index: browserUrl”
pdo php multiple queries with select menu
symfony3 many file fields to one property
How to provide access token based on user role using passport(OAuth 2.0) in laravel 5.4
Twig Error after updating by using composer
php error doesn't get stored in apache logs
Print each element of json curl execution
Mysql query showing different results
Changing from GET to POST
Wordpress localhost URL executing twice
PHP is adding a % to the end of every program when executing [duplicate]