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

Yii2 dropdownlist WITHOUT $model
Joomla 3 user_usergroup_map table set a group_id=9 after registration
not getting user name and id from database in codeigniter
MySQL database insertion error
loop through column of a single row
Get Soap last response
Laravel: Route not found error
unable to receive all ios notifications in device using php apns push
Error in MySQL Syntax My First Project [closed]
Show only specific range of pages in pagination?
Select elements from array (?) (api)
PDO exceptions being affected by ATTR_EMULATE_PREPARES with PostgreSQL
Adding / grouping classes in php
How to select only 1 row from a query result? like the 4th row
PHP round() 0.50 to lower value
PHP SQL query id from table with multiple values in rows

Categories

HOME
apple-push-notifications
paypal-ipn
ews
javafx-8
responsive-design
cocotb
mailing-list
mutation-testing
angular4
live-streaming
amazon-elb
dma
fresco
checkout
boomi
spring-ldap
gitkraken
data-type-conversion
activeadmin
websphere-portal
opentext
web-push
tracing
android-cardview
miniprofiler
amazon-cloudtrail
cube
winsock
snap-framework
riotjs
mongoengine
java-stream
wdk
microkernel
grails-spring-security
hypothesis-test
dagger
transparency
git-tfs
vesta
kitura
audio-converter
uiautomatorviewer
watir-webdriver
nslayoutconstraint
clrs
email-forwarding
google-identity-toolkit
livereload
visual-studio-monaco
p6spy
msbuild-4.0
dpkg
apple-configurator
facebook-ios-sdk
accessibilityservice
teamviewer
i2b2
trust
vim-plugin
pack
ui4j
canopy
enaml
org-babel
subfolder
scala-swing
debug-symbols
jcheckbox
iplimage
visual-studio-6
libgcc
webautomation
meteor-collections
xulrunner
air-native-extension
strdup
mousemotionlistener
coalesce
libxml-js
postgres-xc
indesign-server
xs
notin
jbox2d
clrprofiler
android-dialog
kobold2d
firebird1.5
prototypal-inheritance
netstream
type-safety
glassfish-esb
photo-management
anonymous-types
git-log
downgrade
explicit
reliability
tabbarcontroller
iphone-sdk-4.3
mysqli-multi-query
rawcontacts
rtti
twitter-feed
datagridcolumn
service-factory

Resources

Encrypt Message