Jump to content

Recommended Posts

in php 5, i have....

$my_variablle_results = shell_exec("call my java program");

and the java program does either: System.out.println("SUCCESS"); or System.out.println("FAILURE"); 

it works fine, and if I echo $my_variable_results, i see "SUCCESS" and "FAILURE" like one would expect.

But, if i then do (in php)

if($my_variable_results == "SUCCESS")    // with single or double quotes...

{ echo "it is a success";}    else    { echo "no success"; }

 

"no success" get's printed, even when the echo of $my_variable_results is SUCCESS

Is there something with the format or datatype that could cause this comparison to fail?  i tried declaring declaring it first like:  $my_variable_results = 'test';

before calling  the java program... didn't help.  i am using java 1.4.2 which is pretty old, but i doubt that would be problematic.

any ideas?

thanks,

mike.

Link to comment
https://forums.phpfreaks.com/topic/117394-java-php-variable-question/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.