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

Magento 1.9.x sessions and auto-discovery on AWS ElastiCache
The command http://localhost:8383/wd/hub/session is not recognized by the server
Using php yield / Generator::send() for a “data output stream”
Saving pivot with manytomany relationship in laravel 5.2
Concatenate Table Row Data
Omnipay - Use Paypal Express Checkout Laravel
opencart - php Create an excel file with order details and send it by email
Laravel migration failure apart from migration table
Laravel 5.2 $this->request is null
How to get data from not directly related tables Yii2
PHP - For loop store all array values as one long string
Amazon S3 bucket file upload : Invalid Transfer encoding header
Symfony, No Authentication Provider found for token of class UsernamePasswordToken after login, how to?
File upload works on desktop, but not on mobile using camera
CSRF Codeigniter 2
Using Sessions (or otherwise) what can I do to make my page remember the variables when I go back to it?

Categories

HOME
mc
yaml
schema.org
long-integer
devexpress
haproxy
subdomain
ios-simulator
docker-cloud
jersey-2.0
tibco
ipv6
bittorrent
onvif
responsive-design
bellman-ford
stack-overflow
azure-graph-api
driver
twitter-oauth
clish
amazon-elb
distributed-computing
dma
corona
texas-instruments
uima
vertica
gravity
http-authentication
data-type-conversion
weex
ini
introspection
basex
google-play-developer-api
mongoengine
counting
bean-validation
db2-luw
amazon-kms
rails-postgresql
love2d
jade4j
twilio-php
game-center
react-intl
kitura
wysihtml5
autorelease
image-registration
scala-collections
patternlab.io
dtd
http4s
pbx
cefpython
ipywidgets
xmlbeans
jsonix
nsdata
eclemma
lovefield
outlook.com
lowercase
supersocket.net
darwin
bootstrap-wysiwyg
org-babel
jolie
cakephp-2.2
nidaqmx
coding-efficiency
stripe.net
miglayout
iosched
strcmp
colon
libxml-js
jacob
oscilloscope
background-thread
donut-chart
jquery-cycle
red-system
story
zend-pdf
taskkill
firebird1.5
opends
mkannotation
dropshadow
fbml
simile
bass
explicit
ntruencrypt
twitter-feed
server-load
isapi-redirect
html-generation

Resources

Encrypt Message