note 110302 added to function.urlencode

From: Date: Tue, 09 Oct 2012 14:05:17 +0000
Subject: note 110302 added to function.urlencode
Groups: php.notes 
Request: Send a blank email to php-notes+get-191206@lists.php.net to get a copy of this message
I have designed a new function to get the url encode it will be useful for the SEO url. function customUrlEncode($string) { $string = preg_replace('/\ /','-',$string); $string = preg_replace('/\%/','-',$string); $string = preg_replace('/\@/','-',$string); $string = preg_replace('/\&/','-',$string); $entities = array('%20','%21', '%2A', '%27', '%28', '%29', '%3B', '%3A', '%40', '%26', '%3D', '%2B', '%24', '%2C', '%2F', '%3F', '%25', '%23', '%5B', '%5D'); $replacements = array('-','-', '-', "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-", "-"); return str_replace($entities, $replacements, urlencode($string)); } ---- Server IP: 69.147.83.199 Probable Submitter: 106.51.159.33 ---- Manual Page -- http://www.php.net/manual/en/function.urlencode.php Edit -- https://master.php.net/note/edit/110302 Del: integrated -- https://master.php.net/note/delete/110302/integrated Del: useless -- https://master.php.net/note/delete/110302/useless Del: bad code -- https://master.php.net/note/delete/110302/bad+code Del: spam -- https://master.php.net/note/delete/110302/spam Del: non-english -- https://master.php.net/note/delete/110302/non-english Del: in docs -- https://master.php.net/note/delete/110302/in+docs Del: other reasons-- https://master.php.net/note/delete/110302 Reject -- https://master.php.net/note/reject/110302 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191206) next »