Re: returning array from commandline

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ian wrote:

> I am busy developing a commandline tool that will, in certain
> cirumstances, return an array of information when called and im having
> a problem with this.

Ian, that's a bit of a contradiction - a command line tool returns a
return code. 

> The last part of my code looks like this:
> 
> if(is_array($rslt)) return $rslt;
> else echo $rslt;
> 
> I.e. if its an array dont echo it, return it rather and im have huge
> problems even using that $rslt variable. I have tried various exec
> queries including exec() (with var before function call and as a
> parameter), passthru, backtick operators and none of them allow me to
> use the array after the commandline tool has been run.

Exactly - the array is a PHP construct, once you've called the command
script, you've moved into your basic OS environment - which doesn't
understand about PHP arrays.

> Quick summary: Im accessing a web interface that calls a php file to
> parse some info. That php file may get an array back that I need to
> use in the web interface - but I cant pass it back to the web
> interface from the commandline tool.

Why does it have to be called as a command line tool?  Why not just call
it as a plain PHP function?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux