I have a PHP script which provides some output to angular. That script is useful to get the informations from the Perl script. I'm using exec()
command to call the scripts in PHP. I'm getting what I want, but the problem is time-consuming. I executing the same script thrice to create the array in php. e.g:
exec("/usr/bin/reports -h -r -t ".$this->name." | grep -o '^\S*' | sed '1 d'",$report_id);
exec("/usr/bin/reports -h -r -t ".$this->name." | grep -oP '(?<= ).*' | sed '1 d'",$titles);
exec("/usr/bin/reports -h -r -n ".$this->name." | grep -oP '(?<= ).*' | sed '1 d'",$fullnames);
As you can see I'm executing the same script multiple times only because of changing parameters.
By first command I'm storing report_id
, the second command to store their position and third is for their full names. I need a solution to comprise these three commands into one. Please help to avoid the time complexity.