php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #540 argv and argc problems
Submitted: 1998-07-11 20:23 UTC Modified: 1998-07-11 21:10 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ben dot lavender at cygnet dot co dot uk Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Final Release OS: NT4 SP3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ben dot lavender at cygnet dot co dot uk
New email:
PHP Version: OS:

 

 [1998-07-11 20:23 UTC] ben dot lavender at cygnet dot co dot uk
How can I test argc in an if statement? 

if ( argv > 0)
{
    echo ("there are args");
}

this always fails.

[3] Once I have run
Calling hello.php?a=world&b=tree

parse_str($argv[0]);
if ( ! (isset($a) && isset($b)) )
{
    echo ("failure");
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-11 21:10 UTC] rasmus
if($argc > 0) {
  echo "There are args";
}
But why do you call parse_str() yourself?  In your hello.php example the $a and $b variables will automatically be set by PHP.  You do not need to run parse_str()
(By the way, this is not a bug.  Questions should be sent to php3@lists.php.net)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 02:01:32 2025 UTC