PHP code example of zebba / utility
1. Go to this page and download the library: Download zebba/utility 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/ */
zebba / utility example snippets php
$method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo'); // getFoo
$method = ClassUtility::generateMethodName(ClassUtility::ACCESS_SET, 'foo'); // SetFoo
$method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo_bar'); // getFooBar
$method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'foo bar'); // getFooBar
$method = ClassUtility::generateMethodName(ClassUtility::ACCESS_GET, 'fooBar'); // getFooBar
php
$now = new \DateTime('now');
$period = new \DateInterval('P1D');
try {
$datetimes = ParameterConverter::toArray($now, '\DateTime'); // array($now)
#$datetimes = ParameterConverter::toArray(array($now, $now, $now), '\DateTime'); // array($now, $now, $now)
#$datetimes = ParameterConverter::toArray(array($now, $interval), '\DateTime'); // \DomainException
} catch (\DomainException $e) {
throw $e;
}