1
In the Python
, I know that to read the data entered by the command line we use the function raw_input
.
Example:
Python script:
print 'digite algo para inicializar'
resultado = raw_input()
print 'O resultado é ' + resultado
Command line:
> python script.py
digite algo para inicializar
> teste
o resultado é teste
What about PHP? How to make PHP read the command line entry?
Observing: I want to capture the input not on the script startup, but "in the middle" of it, as in the python
, demonstrated above.
That How to pass arguments to a PHP script via command line? ?
– rray
@rray, in this case the values are initially passed to the script. I wanted to know how to do this when the script has already been initialized.
– Wallace Maxters