Convert Text to slug URL, example: Brown & Cony’s Secret Date! will become: brown-conys-secret-date Will be nice url. function slug_url($text) { // replace non letter or digits by – $text = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $text); // trim $text = trim($text, ‘-‘); // transliterate $text = iconv(‘utf-8’, ‘us-ascii//TRANSLIT’, $text); // lowercase $text = strtolower($text); // remove unwanted Continue reading “Convert Text to Slug URL in PHP”
Category Archives: PHP
Country Code in Array with PHP Value
Just copy and paste into your code to use the country code. <?php $countries = array ( ‘AF’ => ‘Afghanistan’, ‘AX’ => ‘Aland Islands’, ‘AL’ => ‘Albania’, ‘DZ’ => ‘Algeria’, ‘AS’ => ‘American Samoa’, ‘AD’ => ‘Andorra’, ‘AO’ => ‘Angola’, ‘AI’ => ‘Anguilla’, ‘AQ’ => ‘Antarctica’, ‘AG’ => ‘Antigua And Barbuda’, ‘AR’ => ‘Argentina’, ‘AM’ Continue reading “Country Code in Array with PHP Value”
Quick way to convert XML to Array in PHP
This is the dirty and fast way to convert XML file to Array. $array = json_decode(json_encode((array)simplexml_load_string($xml)),1);
