-
-
Save zoffixznet/ef6dd977649eb2857ba832f0e9e1d5d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$com = 'perl6 -e \'use JSON::Fast; slurp.&from-json.reverse».uc.&to-json.put\''; | |
$data = ["foo", "bar", "ber", 42]; | |
$process = proc_open( | |
$com, [0 => ["pipe", "r"], 1 => ["pipe", "w"]], | |
$pipes, '.', NULL | |
); | |
if (is_resource($process)) { | |
fwrite($pipes[0], json_encode($data)); | |
fclose($pipes[0]); | |
echo "Got answer: " . stream_get_contents($pipes[1]); | |
fclose($pipes[1]); | |
$return_value = proc_close($process); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment