PDA

View Full Version : [php] System return values



Pyro.699
September 26th, 2008, 03:06 PM
Hello,

Something has me stumped

In gnome-terminal
echo Hello World
> Hello World

java test
>Hello World

In PHP
system("echo Hello World");
>Hello World

system("java\ test");
>

There is no return value when using java scripts? is there a reason for that becasue the java script is beyond simple...



public class test{
public static void main(String[] args){
System.out.print("Hello World");
}
}


Thanks
~Cody Woolaver

Pyro.699
September 27th, 2008, 07:16 PM
Hey, sorry for the double post but i still havnt found the solution to this problem.

Reiger
September 27th, 2008, 08:50 PM
Try echo [function] ([params]);
Where [function] is your exec/shell_exec/system/w/ever function; and params is the command to be executed...

Pyro.699
September 27th, 2008, 08:57 PM
So something like this?



<?php

function exe($command){
$fh = shell_exec($command);
return $fh;
}

echo exe("java\ test");
?>