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

Issue on Inserting JavaScript Array Data into MySQL Database
Send SMS from PHP script with FreePBX Bootstrap
Is it possible to put a search filter on dropdown list in yii 1?
Select from database where username = any value within an array
yii2 separete module authentication
Display custom post type archive page as homepage
Mysql select from multiple rows in one query [closed]
Why is APCu segfaulting inside a Docker container?
START a proccess in background in WINDOWS
Search for substrings of text in a node in a XML file
Symfony 2 best practice DBAL without object doctrine
Why Facebook does not get correct meta attributes when share post link from webpage? Link is cyrilic - is this the issue?
difference between CRoute and Jroute in Joomla 3
PHP optimizing queries in customer class
html email is not displaying in proper format in email (except gmail) when I send it using php mail function
Wordpress one-page template with dynamic portfolio section

Categories

HOME
spring-data
shinyapps
ontouchlistener
clearcase
eclipse-plugin
livecode
applescript
key
compilation
loopbackjs
apk
liferay-7
moodle-api
apache-kafka-connect
impala
responsive-design
swarm
lda
graphdb
chromecast
buffer
bootstrap-switch
sslhandshakeexception
freertos
ex
dma
fresco
vmware-workstation
user-defined-types
codefluent
multiple-tables
cmake-gui
opam
libgit2
spring-ldap
bsd
hdl
qa
rxjs5
pubxml
background-color
android-cardview
javax.persistence
mdns
objectmapper
progid
epplus
seafile-server
xerces-c
runtimeexception
cordys-opentext
love2d
widestring
linq.js
python-sounddevice
best-buy-api
microkernel
plane
viewcontroller
minikube
fluid-mac-app-engine
expandablelistview
git-tfs
sendinput
absolute
ol3-google-maps
android-sharing
glassfish-4.1
google-identity-toolkit
xmlbeans
mathjs
data-management
jenkins-workflow
cdo.message
fragmentstatepageradapter
codecharge
strpos
simian
cortana
juniper-network-connect
apache-commons-digester
featuretoggle
org-babel
scala-macros
innerhtml
utf8-decode
category-theory
communicate
windows-taskbar
iosched
armv6
vlab
iirf
stty
node.js-stream
dibs
html-frames
oembed
gitx
workflow-manager-1.x
kext
rational-unified-process
autobench
server-load
acceleration
activex-exe
isapi-redirect
rendering-engine

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile