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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 10:01:30 2024 UTC