User Tools

Site Tools


uphp:functions:ini_get_array

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

uphp:functions:ini_get_array [2017/04/13 13:29]
jeff
uphp:functions:ini_get_array [2021/09/13 05:57]
Line 1: Line 1:
-======ini_get_array====== 
- 
-<badge>WMPRO, WMMINI FW >= 1.0</badge> <badge>WMMEGA FW >= 2.0</badge> 
- 
-Get a group of parameters from an INI file as an <html><b><span style="color:green">array<span style="color:black"></b></html> 
- 
-====Description==== 
- 
-<well size="sm"> 
-<html> 
-<span style="font-size:125%;color:green">array 
-<span style="color:black"> 
-</html> 
-[[ini_get_array]] ( 
-<html> 
-<span style="color:green">string 
-<span style="color:blue">$filename 
-<span style="color:black">[, 
-<span style="color:green">string 
-<span style="color:blue">$section 
-<span style="color:black">] ) 
-</html> 
-</well> 
- 
-This function reads multiple configuration key/value pairs from an INI file. 
- 
-====Parameters==== 
- 
-<html><b><span style="color:blue">$filename<span style="color:black"></b></html>:  Full path and name of the INI file 
- 
-<html><b><span style="color:blue">$section<span style="color:black"></b></html>:  Optional, name of the section inside the INI file 
- 
-====Return Values==== 
- 
-<html>If <b><span style="color:blue">$section<span style="color:black"></b> is specified:  a single-dimensional <b><span style="color:green">array<span style="color:black"></b>, with all key/value pairs in the section.</html> 
- 
-<html>If <b><span style="color:blue">$section<span style="color:black"></b> is not specified:  a two-dimensional <b><span style="color:green">array<span style="color:black"></b></html> __containing the entire INI file__.  The first dimension will contain the sections and the second the key/value pairs. 
- 
-<alert type="warning">Loading an entire INI file can be memory intensive and should be avoided if the file has more than just a few elements.  Instead, use [[ini_get]] to load specific values, which works well with large files. Or for fast access consider using NVRAM to store a large collection of data.</alert> 
- 
-====Example==== 
- 
-Given that the file /ini_get_array_example.ini contains: 
- 
-<code> 
-[settings] 
-name=John 
-age=33 
-</code> 
- 
-... this code will read the entire INI file into $arr and display the contents: 
- 
-<code php> 
-<pre><? 
-  $arr=ini_get_array("/ini_get_array_example.ini"); 
-  print_r($arr); 
-?></pre> 
-</code> 
- 
-... and the output will be: 
- 
-<code> 
-[$arr] = Array ( 
-[settings] = Array ( 
-    (string) [name] => John 
-    (int) [age] => 33 
-) 
- 
-</code> 
- 
-====See Also==== 
- 
-[[ini_get()]] - Get a value from an INI file 
- 
-[[ini_put_array()]] - Write a group of parameters to an INI file from an <html><b><span style="color:green">array<span style="color:black"></b></html> 
- 
-[[ini_set()]] - Set a value in an INI file 
  
uphp/functions/ini_get_array.txt · Last modified: 2021/09/13 05:57 (external edit)