@@ -227,7 +227,7 @@ echo '(loaded) magic_quotes_gpc = ' . yesno(get_cfg_var('magic_quotes_gpc')) . P
227
227
</para >
228
228
<para >
229
229
<example >
230
- <title >value interpolation </title >
230
+ <title >Value Interpolation </title >
231
231
<para >
232
232
In addition to evaluating constants, certain characters have special meaning in an ini value.
233
233
Additionally, environment variables and previously defined values may be read using
@@ -250,17 +250,66 @@ negative_two = ~1
250
250
; () is used for grouping
251
251
seven = (8|7)&(6|5)
252
252
253
- ; \ is used to escape a value.
254
- newline_is = "\\n" ; results in the string "\n", not a newline character.
255
- with quotes = "She said \"Exactly my point\"." ; Results in a string with quote marks in it.
256
-
257
253
path = ${PATH}
258
254
also_five = ${five}
259
255
260
256
]]>
261
257
</programlisting >
262
258
</example >
263
259
</para >
260
+ <para >
261
+ <example >
262
+ <title >Escaping Characters</title >
263
+ <para >
264
+ Some characters have special meaning in double-quoted strings and must be escaped by the backslash prefix.
265
+ First of all, these are the double quote <code >"</code > as the boundary marker, and the backslash <code >\</code > itself
266
+ (if followed by one of the special characters):
267
+ </para >
268
+ <programlisting >
269
+ <![CDATA[
270
+ quoted = "She said \"Exactly my point\"." ; Results in a string with quote marks in it.
271
+ hint = "Use \\\" to escape double quote" ; Results in: Use \" to escape double quote
272
+ ]]>
273
+ </programlisting >
274
+ <para >
275
+ There is an exception made for Windows-like paths: it's possible to not escape trailing backslash
276
+ if the quoted string is directly followed by a linebreak:
277
+ </para >
278
+ <programlisting >
279
+ <![CDATA[
280
+ save_path = "C:\Temp\"
281
+ ]]>
282
+ </programlisting >
283
+ <para >
284
+ If one does need to escape double quote followed by linebreak in a multiline value,
285
+ it's possible to use value concatenation in the following way
286
+ (there is one double-quoted string directly followed by another one):
287
+ </para >
288
+ <programlisting >
289
+ <![CDATA[
290
+ long_text = "Lorem \"ipsum\"""
291
+ dolor" ; Results in: Lorem "ipsum"\n dolor
292
+ ]]>
293
+ </programlisting >
294
+ <para >
295
+ Another character with special meaning is <code >$</code > (the dollar sign).
296
+ It must be escaped if followed by the open curly brace:
297
+ </para >
298
+ <programlisting >
299
+ <![CDATA[
300
+ code = "\${test}"
301
+ ]]>
302
+ </programlisting >
303
+ <para >
304
+ Escaping characters is not supported in the <constant >INI_SCANNER_RAW</constant > mode
305
+ (in this mode all characters are processed "as is").
306
+ </para >
307
+ <para >
308
+ Note that the ini parser doesn't support standard escape sequences (<code >\n</code >, <code >\t</code >, etc.).
309
+ If necessary, post-process the result of <function >parse_ini_file</function > with <function >stripcslashes</function > function.
310
+ </para >
311
+ </example >
312
+ </para >
264
313
</refsect1 >
265
314
266
315
<refsect1 role =" notes" >
0 commit comments