Question: I was working in php java bridge and came across this problem.
The below is the code

```
 $payID     =  $epaymentpipe->getPaymentId();

 echo $payID;

```

the expected value is printed e.g., 5323423123

but when i pass the same variable in header like below, the object id is passing in payID.

```
header("location: URL?PaymentID=".$payID);

```

**it is passing like <http://URL?PaymentID=Object> id #53**

I Need to know whats happening here. When the variable is echoed its printing correctly but when i use the variable the object id is passing.

Answer: 
Cast the object as a string:

```
$payID = (string)$epaymentpipe->getPaymentId();
header("location: URL?PaymentID=".$payID);

```
The definition of echo is different as of that of print\_r and var\_dump, whenever any such thing happens check the value by dumping it through print\_r or var\_dump.