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

get profile picture url from Windows live
SugarCRM: Hierarchy Using 'Reports to' Field?
Distinguish users Codeigniter
PHP - List pulled from one field exploding commas
how we can count items by id in database using laravel
Display All Followed Users In Laravel
PHP with MS sql server
Select all from MySql and join other
How to call an artisan console command with an interaction
How to implement Abstract class in laravel 5
PHP: Convert epoch to MySQL DateTime format
How to check if JSON object exists
Opencart: need help for checkout extension
php - Parse.com change createdAt Column timezone
Laravel 5 sending email via mandrill errors
How to get AppController beforeFilter data in Model?

Categories

HOME
azure-functions
automapper
clearcase
kivy
hdfs
website
whmcs
apk
semantic-web
tcp
material-components
mosquitto
ontology
openfoam
angular-meteor
firebase-database
phpmqtt
minecraft
user-defined-types
exec-maven-plugin
maven-plugin
susy-sass
codefluent
spam
spyder
pst
conda
intel
router
prompt
running-object-table
history.js
acrobat
boolean-logic
microprocessors
dotcms
python-2.x
om-next
kendo-listview
rails-postgresql
pdfnet
ms-solver-foundation
identify
eclipse-gmf
aurelia-http-client
cheat-engine
cloudera-sentry
flipkart
web-inspector
nuclio
jenkins-slave
windows-media-player
tinyioc
django-static-precompiler
nothing
head.js
hibernate-ogm
htmlspecialchars
android-mediarecorder
test-data
case-when
degrees
deviare
callouts
declarative
perforce-integrate
mercurial-extension
i2b2
pack
juniper-network-connect
google-maps-api-2
opencyc
dnx50
vdm-sl
artisan
flow-js
tidyr
operands
password-recovery
cakephp-2.2
smacss
jquery-mobile-flipswitch
lmax
git-reset
xmi
accountmanager
oxygene
django-settings
itunes-sdk
wcf-callbacks
gwt-celltable
getopts
jquery-1.4
ccnet-config
.net-services
getimagesize
subtext
fuzzy-comparison
rtti
accumulator

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App