Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17066

Re: How to know the last arg in a series

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: How to know the last arg in a series
Date 2016-09-19 18:53 +0200
Message-ID <e4ajfpF976pU1@mid.individual.net> (permalink)
References <1b8fa718-fcde-4e92-9ad3-cc69e41f5a0b@googlegroups.com>

Show all headers | View raw


On 09/19/2016 08:51 AM, bit-naughty@hotmail.com wrote:
> If I have a page where there are args like "arg1=2&arg2=93&arg3=112", and so on, but there is No Limit to how many "arg"s there can be, how do I find out which one the last arg is ("arg3" in the above case)?
> 
> 
> Thanks.
> 

With the huge amount of information I just assumed that you wanted to
play with the QUERY_REQUEST _SERVER value. This solution do not use
regexp, which would be a better solution:

<?php
if(!empty($_SERVER['QUERY_STRING'])) {
    $array = explode('&', $_SERVER['QUERY_STRING']);
    if(strpos($array[count($array) -1], '=')!==false) {
        list($key, $value) = explode('=', $array[count($array) -1]);

        echo "The key is '${key}'\n";
        echo "The valu is '${value}'\n";
    } else {
        echo "Didn't manage to find any values in the query string\n";
    }
} else {
    echo "No get values was sent\n";
}
?>


If it was something else you wanted, then please describe your problem
in detail, so that we can understand what you are trying to do.

-- 

 //Aho

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to know the last arg in a series bit-naughty@hotmail.com - 2016-09-18 23:51 -0700
  Re: How to know the last arg in a series "R.Wieser" <address@not.available> - 2016-09-19 10:00 +0200
    Re: How to know the last arg in a series bit-naughty@hotmail.com - 2016-09-21 23:54 -0700
      Re: How to know the last arg in a series "R.Wieser" <address@not.available> - 2016-09-22 09:03 +0200
  Re: How to know the last arg in a series bill <william@TechServSys.com> - 2016-09-19 07:05 -0400
  Re: How to know the last arg in a series Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-19 08:45 -0400
    Re: How to know the last arg in a series Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-09-19 14:10 +0100
      Re: How to know the last arg in a series Jerry Stuckle <jstucklex@attglobal.net> - 2016-09-19 10:55 -0400
  Re: How to know the last arg in a series "J.O. Aho" <user@example.net> - 2016-09-19 18:53 +0200
  Re: How to know the last arg in a series Arno Welzel <usenet@arnowelzel.de> - 2016-09-19 21:38 +0200
  Re: How to know the last arg in a series bit-naughty@hotmail.com - 2016-09-22 00:02 -0700
    Re: How to know the last arg in a series Luuk <luuk@invalid.lan> - 2016-09-22 17:07 +0200
      Re: How to know the last arg in a series Luuk <luuk@invalid.lan> - 2016-09-22 17:08 +0200

csiph-web