Use the following table as a desk reference for the various fopen modes and how they impact read, write and seek.
Mode | Read | Write | Seek |
---|---|---|---|
r | ✔️ | ❌ | ✔️ |
r+ | ✔️ | ✔️ | ✔️ |
w | ❌ | ✔️ | ✔️ |
w+ | ✔️ | ✔️ | ✔️ |
# import the public key | |
gpg --import ../alice.asc | |
gpg --export $KEYID | openpgp2ssh $KEYID |
function find( ?string $string ) | |
{ | |
static $found = 0; | |
if( null === $string ) return $found; | |
$found += 0 === strpos( $string, BOM_UTF8 ); | |
$found += 0 === strpos( $string, BOM_UTF16_BE ); | |
$found += 0 === strpos( $string, BOM_UTF16_LE ); | |
$found += 0 === strpos( $string, BOM_UTF32_BE ); |
<?php | |
class Str | |
{ | |
/** | |
* Generate and return a random string having a specified length and composed of a specified | |
* set of characters. | |
* | |
* <i>This method is multibyte safe.</i> |
Use the following table as a desk reference for the various ways to obtain properties of objects and which properties each method returns.
Method/Operator/Loop | own | proto | enumerable | non-enumerable |
---|---|---|---|---|
for prop in obj |
✔️ | ✔️ | ✔️ | ❌ |
prop in obj |
✔️ | ✔️ | ✔️ | ✔️ |
obj.hasOwnProperty( prop ) |
✔️ | ❌ | ✔️ | ✔️ |
obj.propertyIsEnumerable( prop ) |
✔️ | ❌ | ✔️ | ❌ |
<?php | |
/** | |
* Recursively empty and delete a directory | |
* | |
* @param string $path | |
* @ref https://gist.github.com/jmwebservices/986d9b975eb4deafcb5e2415665f8877 | |
*/ | |
function rrmdir( string $path ) : void | |
{ |
<?php error_reporting(E_ALL); | |
function test() {} | |
$nIter = 1000000; | |
$argNums = [0, 1, 2, 3, 4, 5, 100]; | |
$func = 'test'; | |
foreach ($argNums as $argNum) { |
<?php | |
/** | |
* Apply filters over the iterable values of a DatePeriod object | |
* | |
* @method self monday Include Mondays while iterating the DatePeriod | |
* @method self tuesday Include Tuesdays while iterating the DatePeriod | |
* @method self wednesday Include Wednesdays while iterating the DatePeriod | |
* @method self thursday Include Thursdays while iterating the DatePeriod | |
* @method self friday Include Fridays while iterating the DatePeriod | |
* @method self saturday Include Saturdays while iterating the DatePeriod |