logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology See What Others Are Saying!
  • Question
  • What is the difference between $argv and $argc? Give example?


  • Correct Answer
  • To pass the information into the script from outside, help can be taken from the PHP CLI (Command line interface) method Suppose addition of two numbers has to be passed to PHP then it can be passed like this on the command line: php addphp 2 3 Here the script name is addphp, and 2 and 3 are the numbers that has to be added by the script These numbers are available inside the script in an array called $argv This array contains all the information on the command line; the statement is stored as follows: $argv[0]=addphp $argv[1]=2 $argv[2]=3 So, $argv always contains at least one element ? the script name Then, in your script, you can use the following statements: $sum = $argv[1] + $argv[2]; echo $sum; $argc is a variable that stores the numbers of elements in $argv $argc is equal to at least 1, which is saved for the name of the script Example is $argc=3 using the above statements 


  • More questions

    • 1. What is CRR rate?
    • Discuss
    • 2. Which among the following are not access Specifiers in C++?

    • Options
    • A. Public
    • B. Protected
    • C. Default
    • D. Private
    • Discuss
    • 3. In which year, the first bank of India "Bank of Hindustan" was established ?

    • Options
    • A. 1677
    • B. 1770
    • C. 1796
    • D. 1831
    • Discuss
    • 4. What could be the bucket size if collision and overlapping occur at same time?

    • Options
    • A. 2
    • B. 0
    • C. 1
    • D. 4
    • Discuss
    • 5. Default constructor accepts how many arguments?

    • Options
    • A. one
    • B. two
    • C. three
    • D. None
    • Discuss
    • 6. What are the mandatory part to present in function pointers?

    • Options
    • A. &
    • B. retrun values
    • C. data types
    • D. none of these
    • Discuss
    • 7. Which of the following can derived class inherit?

    • Options
    • A. members
    • B. functions
    • C. both a & b
    • D. None of the above
    • Discuss
    • 8. What kind of object is modifying sequence algorithm?

    • Options
    • A. Function template
    • B. Class template
    • C. Method
    • D. None of these
    • Discuss
    • 9. Fixed Foreign Exchange rate can be changed by

    • Options
    • A. SEBI
    • B. Ministry of Finance
    • C. RBI
    • D. All of the above
    • Discuss
    • 10. The shortcut key to quit from tally is

    • Options
    • A. CTRL + Q
    • B. CTRL + ESC
    • C. CTRL + T
    • D. CTRL + P
    • Discuss


    Comments

    There are no comments.

Enter a new Comment