PHP code example of phy / variable
1. Go to this page and download the library: Download phy/variable library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phy / variable example snippets
use PHY\Variable\Obj;
use PHY\Variable\Str;
/*
* This is probably the few things that's actually helpful. Although this
* example is bad since you can have json_decode return an associated array
* anyways... You can also do the reverse of this (recursive: array => object).
*/
$object = new Obj(json_decode('{"something":"else"}'));
$primativeArray = $object->toArray();
/*
* Some of the chaining isn't totally useless, especially if you're manipulating
* a string or array.
*/
$randomString = Str::random(16);
$randomString->chain()
->pad(20, '_', STR_PAD_BOTH)
->split(0, 14)
->shuffle();
echo $randomString;
/*
* Stupid password encryption (WARNING, IF YOU DO THIS YOU'RE AN IDIOT).
*/
$password = new Str('password');
echo $password->rot13();