note 12438 deleted from function.exec by vincent
| From: | vincent@php.net | Date: | Wed, 10 Sep 2003 18:55:56 +0000 |
| Subject: | note 12438 deleted from function.exec by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-55992@lists.php.net to get a copy of this message | ||
Note Submitter: marat@provote.com
----
After agonizing over the seemingly simple question of how to pass back a string value from a PERL
script to a PHP script, trying the system, and passthru functions, as well as backticks, proved
futile. However this wonderful exec function is the answer. It's terribly simple:
If you want to return any number of scalars from your PERL script to PHP, then print them to stdout
at the end of your PERL, as in:
<pre>
print $scalar1 ;
print $scalar2 ;
print $scalar3 ;
</pre>
Then, on the PHP side, you simply declare:
<pre>
exec("path_to_perl_file", $array)
</pre>
Now you just loop through $array, to grab the scalars output by your PERL script... Enjoy, hope this
helps someone...