atiksoftware / php-class-cover
PHP文本、数字、数组格式比较
1.1
2018-11-24 07:51 UTC
This package is auto-updated.
Last update: 2024-09-24 20:28:49 UTC
README
PHP文本和数组修改器。
安装
使用Composer
composer require atiksoftware/php-class-cover
require __DIR__.'/../vendor/autoload.php'; use \Atiksoftware\Cover\Text; use \Atiksoftware\Cover\Arr;
文本函数
echo Text::toHex(100000); # 186A0 echo "\n"; echo Text::toDec(AFAAB); # 719531 echo "\n"; echo Text::toUpper("mansur atik"); # MANSUR ATİK echo "\n"; echo Text::toLower("MANSUR ATİK"); # mansur atik echo "\n"; echo Text::toUpFirst("MANSUR ATİK"); # Mansur Atik echo "\n"; echo Text::fixChars("Üzümü ye bağını sorma"); # Uzumu ye bagini sorma echo "\n"; echo Text::clearSpecialChars("Amiral & Bristol ! _"); # Amiral Bristol echo "\n"; echo Text::Truncate("Lorem ipsum dolor sit amet, consectetur adipisicing elit.",30); # Lorem ipsum dolor sit amet, consectetur echo "\n"; echo Text::formatFirstName("mansur"); # Mansur echo "\n"; echo Text::formatLastName("atik"); # ATİK echo "\n"; echo Text::formatFullName("mansur amiral atik"); # Mansur Amiral ATİK echo "\n"; echo Text::formatPhone("6325252"); # 632-5252 echo "\n"; echo Text::formatPhone("2642655254"); # 0264 265 5254 echo "\n"; echo Text::formatPhone("5414855652"); # 0541 485 5652 echo "\n";
数组函数
$example = [ "user" => [ "fname" => "Mansur", "lname" => "ATİK", "age" => 24, "props" => [ "auths" => [ "insert" => true, "update" => true, "delete" => true, ], "langs" => [ "tr", "en", "ar" ] ] ] ]; echo Arr::Not($example,"user.fname"); # Mansur echo "\n"; Arr::Not($example,"user.props.auths.select",true); print_r(Arr::Not($example,"user.props.auths")); // "auths" => [ // "insert" => true, // "update" => true, // "delete" => true, // "select" => true, // ], echo "\n";