PHP code example of daikazu / misc-helpers
1. Go to this page and download the library: Download daikazu/misc-helpers 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/ */
daikazu / misc-helpers example snippets
$hours = [
'monday' => ['open' => '09:00', 'close' => '17:00'],
'tuesday' => ['open' => '09:00', 'close' => '17:00'],
'wednesday' => ['open' => '09:00', 'close' => '17:00']
];
$formatted = format_business_hours($hours, 'America/New_York');
echo $formatted; // Outputs: Monday - Wednesday 9am-5pm EDT
$content = '<p>This is a very short text.</p>';
$readTime = calculate_read_time($content);
echo $readTime; // Outputs: 1
$isEmpty = is_blade_section_empty('test');
var_dump($isEmpty); // Outputs: bool(false)
$name = 'John Doe';
$initials = generate_initials($name);
echo $initials; // Outputs: JD
$string = ' Hello World ';
$cleaned = clean_string($string);
echo $cleaned; // Outputs: Hello World
use App\Utilities\PhpArrayFormatter;
$array = [
'name' => 'John Doe',
'email' => '[email protected] ',
'roles' => ['admin', 'user']
];
$formatter = new PhpArrayFormatter();
$formattedArray = $formatter->format($array);
echo $formattedArray;
// Outputs:
// [
// 'name' => 'John Doe',
// 'email' => '[email protected] ',
// 'roles' => [
// 'admin',
// 'user'
// ]
// ]
bash
php artisan log:prune
bash
php artisan log:prune --days=15