A collection of PHP functions that I often use
composer require panduanvip/helpers
<?php
include 'vendor/autoload.php';
use PanduanVIP\Helpers\Please;
echo Please::getWebContent('https://google.com');
Result:
return html page from google.com
echo Please::getWebContents(['https://google.com', 'https://yahoo.com']);
Result:
return html pages from google.com dan yahoo.com
echo Please::createRandomString();
Result:
7y2cNs
$array = ['Pen', 'Book', 'Laptop', 'Bus', 'Plane', ''];
$result = Please::pickOneRandom($array);
Result:
Book
$string = "Gunadarma , Jayabaya, Pancasila,,";
$result = Please::trimAllSpaces($string, ',');
Result:
Gunadarma,Jayabaya,Pancasila
$string = "{green|blue|yellow} bird is sitting {there|over there|on the ground}.";
$result = Please::createSpintax($string);
Result:
blue bird is sitting on the ground.
$string = <<<test
Example of string
spanning multiple lines
using heredoc syntax.
test;
$result = Please::explodeNewLine($string);
Result:
['Example of string', 'spanning multiple lines', 'using heredoc syntax.']
$string = "PHP is a general-purpose scripting language especially suited to web development. It was stringly created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The PHP reference implementation is now produced by The PHP Group.";
$result = Please::createExcerpt($string, 50);
Result:
PHP is a general-purpose scripting language...
$string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
$result = Please::removeDoubleSpace($string);
Result:
Lorem ipsum dolor sit amet, consectetur adipiscing elit
$string = "This is my dog!";
$result = Please::getStringBetween($string, "my", "!");
Result:
dog
$string = "красивые сакуры";
$result = Please::createSlug($string);
Result
красивые-сакуры