returning array from commandline

From: Date: Fri, 10 Oct 2008 13:37:50 +0000
Subject: returning array from commandline
Groups: php.general 
Request: Send a blank email to php-general+get-281664@lists.php.net to get a copy of this message
Hi, 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. 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. I also dont know how many levels the array may have as im referencing other functions that change them based on the query given to the commandline tool so I cant even put it into a string before returning it as i dont know how many levels are involved and are returned from the function call inside the commandline app. Does anyone have any suggestions as to how I could achieve this or any better ways of doing it? 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. Thanks Ian

« previous php.general (#281664) next »