Re: returning array from commandline
| From: | Ian | Date: | Tue, 14 Oct 2008 12:49:45 +0000 |
| Subject: | Re: returning array from commandline | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-281862@lists.php.net to get a copy of this message | ||
This is resolved - I used serialize and unserialize which worked a treat.
Thanks for the suggestion :)
On Fri, Oct 10, 2008 at 8:17 PM, Richard Lynch <rlynch@peak6.com> wrote:
> Convert it to XML or JSON.
>
> Those port quite nicely to anything.
>
> For all-PHP, you can use serialize to make it a string.
>
>> -----Original Message-----
>> From: Ian [mailto:barnracoon@gmail.com]
>> Sent: Friday, October 10, 2008 8:38 AM
>> To: php-general@lists.php.net
>> Subject: [PHP] returning array from commandline
>>
>> 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
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> _______________________________________________________
>
> The information in this email or in any file attached
> hereto is intended only for the personal and confiden-
> tial use of the individual or entity to which it is
> addressed and may contain information that is propri-
> etary and confidential. If you are not the intended
> recipient of this message you are hereby notified that
> any review, dissemination, distribution or copying of
> this message is strictly prohibited. This communica-
> tion is for information purposes only and should not
> be regarded as an offer to sell or as a solicitation
> of an offer to buy any financial product. Email trans-
> mission cannot be guaranteed to be secure or error-
> free. P6070214
>