Skip to content

Instantly share code, notes, and snippets.

Segu msegu

Block or report user

Report or block msegu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
msegu / inArray.php
Created Jul 18, 2018
php in_array() extension
View inArray.php
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
/** 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)
msegu / toURI.php
Last active Aug 8, 2018
URL/URI full encoding
View toURI.php
Need to encode given (finished) path and query?, for example
'' (1)
or 'scheme://' (2)
e.g. this (2) should be encoded:
msegu / gzdecodeM.php
Created Jul 11, 2018
php gzdecode() replacement/extension
View gzdecodeM.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)
msegu / parse_ini_stringM.php
Last active Jul 10, 2018
php parse_ini_string() fix
View parse_ini_stringM.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)
You can’t perform that action at this time.