evRemoveParamURL | removes a parameter of a given URL and returns it


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // name: evRemoveParamURL
  2. // version: v0.1
  3. // description: elimina un parametro en una URL
  4.  
  5. function evRemoveParamURL( $url, $key ) {
  6. $url = preg_replace( '/(.*)(\?|&)' . $key . '=[^&]+?(&)(.*)/i', '$1$2$4', $url . '&' );
  7. $url = substr( $url, 0, -1 );
  8. return ( $url );
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.