This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
php parse_ini_string() extension | |
With function below you can: | |
- fix unvalued fields ('key' (invalid) ==> 'key=' (OK) ) | |
- fix unquotted values with equal sign '=' ('key=value_part1=value_part2' ==> 'key="value_part1=value_part2"') | |
- fix (solve) multidimensional arrays (makes 'key[key1][key2]=value' valid) | |
- fix any reading errors (wrong lines, they may be later rawurldecoded with md5 checking) | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can use function inArray below, to search: | |
- multidimensional arrays | |
- for substrings (case [in]sensitive) | |
- for sub-arrays | |
- get array of keys of found values | |
<?php | |
/** Function 'inArray' checks if a value exists in an array (also multidimensional): if string as substring (case-[in]sensitive), or other value as a element of the same type | |
* | |
* @param mixed $needle Value to find (string: as (sub)string, array: as (sub)array, other: as exact element) | |
* @param array $haystack The array for search (can be multidimensional) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Need to encode given (finished) path and query?, for example | |
'http://example.org:port/path1/path2/data?key1=value1&argument#fragment' (1) | |
or 'scheme://user:password@example.com:port/path1/path2/data?key1=value1&key2=value2#fragment' (2) | |
e.g. this (2) should be encoded: | |
'scheme://'.rawurlencode('user').':'.rawurlencode('password').'@example.com:port/' | |
.rawurlencode('path1').'/'.rawurlencode('path2').'/'.rawurlencode('data') | |
.'?'.htmlentities(urlencode('key1').'='.urlencode('value1').'&'.urlencode('key2').'='.urlencode('value2')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** function 'gzdecodeM' | |
* @param data string .GZ data | |
* @param gz array (optional) Returned array of file sections properties | |
* @param error string (optional) Returned error (if any) | |
* @param maxlength int (optional) Max length of uncompressed data | |
* @param sects string (optional) Sections to uncompress, e.g. '0-3, 5, 8-p100000, 100-' (where: '0' - section number, 'p0' - file .gz position in Bytes, 'x-' - from section x to the end of file) | |
* Note: sections are extracted once and in the order they are in the .gz file, not how they are listed | |
* @return Uncompressed data (if OK) | |
*/ |