PHP - Sacar Parametro de "string tipo QS"


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

ej:
echo keepqsSinParametro('hola','hola=mundo&mundo=lindo&hola=chau'); #out = mundo=lindo


Copy this code and paste it in your HTML
  1. function keepqsSinParametro($parametro, $keepqs = ''){
  2. if( empty($keepqs) ) global $keepqs;
  3. $keepqs = urldecode($keepqs);
  4. return preg_replace('/[\&\?]?'.$parametro.'=[^\&]*/','', $keepqs);
  5. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.