Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Get Multiple Parameters with same name from a URL in PHP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.94k
    Comment on it

    Hello readers, Below example will help you to "Get Multiple Parameters with same name from a URL in PHP".

    <?php
    
    $query  = explode('&', $_SERVER['QUERY_STRING']);
    $params = array();
    
    foreach( $query as $param )
    {
      list($name, $value) = explode('=', $param, 2);
      $params[urldecode($name)][] = urldecode($value);
    }
    
    ?>
    

    Output:

    array(
      'ctx_ver'     => array('Z39.88-2004'),
      'rft_id'      => array('info:oclcnum/1903126', 'http://www.biodiversitylibrary.org/bibliography/4323'),
      'rft_val_fmt' => array('info:ofi/fmt:kev:mtx:book'),
      'rft.genre'   => array('book'),
      'rft.btitle'  => array('At last: a Christmas in the West Indies.'),
      'rft.place'   => array('London'),
      'rft.pub'     => array('Macmillan and co.'),
      'rft.aufirst' => array('Charles'),
      'rft.aulast'  => array('Kingsley'),
      'rft.au'      => array('Kingsley, Charles'),
      'rft.pages'   => array('1-352'),
      'rft.tpages'  => array('352'),
      'rft.date'    => array('1871')
    )
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: