I'm a PHP newbie... I usually script with bash, where I can easily do something like this:
#!/bin/bash
# myscript.sh
function testFunction() {
echo "bubu" > /dev/tty
echo "gaga"
}
a=$(testFunction)
echo $a > t
If I run it in a shell I get this:
$ ./myscript.sh
bubu
$ cat t
gaga
Now, how can I get the same output if I have a PHP file instead of the function?
// my script.php
echo "bubu";
echo "gaga";
Bash script:
#!/bin/bash
# myscript.sh
a=$(php myscript.php)
echo $a > t
If I run it in a shell I get this:
$ ./myscript.sh
$ cat t
bubu
gaga
How can I tell the php script to send "bubu"
to /dev/tty
?
I tried and play around with ob_start
and his friends, but didn't get any result.