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]

Categories

HOME
plesk
focus
add-on
windows-10
subdomain
mathematical-optimization
position
tfs2010
migrate
watch-os-3
google-awareness
closures
uima
gmp
codefluent
anova
sqlplus
batch-rename
mime-types
intel
sybase-ase
mod-wsgi
nurbs
fusetools
tracing
uri
android-service
adapter
bitbake
basic-authentication
es6-modules
dotcms
tightvnc
series
knights-tour
private-key
mongoengine
markov-chains
forms-authentication
fastlane
microsoft-ui-automation
dagger
contactless-smartcard
roracle
skip-lists
watir-webdriver
ptvs
network-protocols
sesame
case-when
alertify
cognos-tm1
elastic4s
apache-pig-grunt
teamviewer
godeps
in-app-billing
ambiguity
bjam
supersocket.net
dynamics-ax-2012-r2
karma-coverage
webproject
android-audiomanager
python-c-extension
ssmtp
nhibernate-criteria
operands
ildasm
utf8-decode
dmake
iplimage
full-text-indexing
lumia-imaging-sdk
box2dweb
nachos
screwturn
bittorrent-sync
assetic
particle-swarm
form-for
node.js-stream
pacman
sly-scroller
axacropdf
jbox2d
ckeditor.net
user-forums
spark-view-engine
story
border-box
kaazing
fitch-proofs
yuidoc
filelock
asp.net-mvc-views
digiflow
outlook-2007-addin
rational-unified-process
processors
subtext
iphone-sdk-3.1.3
objectinstantiation
code-camp

Resources

Encrypt Message