Last active
March 21, 2020 15:42
-
-
Save locvfx/b51dfa35e62a04f3d9e8535bf14e589d to your computer and use it in GitHub Desktop.
PHP - Usefull functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ucfirst(strtolower($row['name'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$loop = 10; | |
$end_id = $start_id + $loop ; | |
echo "<a href='/admin/developer/inventory/auto_update_shop_column/$end_id'>>>>>>>>>>>>>>>>>>>>> NEXT</a><br>"; | |
for ($i=1; $i <= $loop ; $i++) { | |
$this->update_shop_column ($start_id); | |
$start_id++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mb_convert_encoding($string, 'UTF-8', 'UTF-8'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$variable = substr($variable, 0, strpos($variable, "By")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getKeywordSuggestionsFromGoogle($keyword) { | |
$keywords = array(); | |
$data = file_get_contents('http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl=en-US&q='.urlencode($keyword)); | |
if (($data = json_decode($data, true)) !== null) { | |
$keywords = $data[1]; | |
} | |
return $keywords; | |
} | |
var_dump(getKeywordSuggestionsFromGoogle('money')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error_reporting(E_ALL & ~E_NOTICE & ~ E_WARNING); | |
ini_set('display_errors', 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function url_get_contents ($Url) { | |
if (!function_exists('curl_init')){ | |
die('CURL is not installed!'); | |
} | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $Url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$output = curl_exec($ch); | |
curl_close($ch); | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment