<p>I think this is more of a PHP question versus bitcoin, but that's how PHP handles a zero float. <a href="https://www.php.net/manual/en/language.types.type-juggling.php" rel="nofollow noreferrer">https://www.php.net/manual/en/language.types.type-juggling.php</a></p>
<pre><code>$var = 0.00000000;
echo $var;
 
</code></pre>
<p>Returns:</p>
<pre><code>0
</code></pre>
<p>If you want to force a zero value to eight decimals you can use <code>number_format()</code> <a href="https://www.php.net/manual/en/function.number-format" rel="nofollow noreferrer">https://www.php.net/manual/en/function.number-format</a></p>
<pre><code>$var = 0.00000000;
$formatted = number_format($var, 8);
echo $formatted;
 
</code></pre>
<p>Returns:</p>
<pre><code>0.00000000
</code></pre>

CC BY-SA 4.0
2021-01-22T16:28:47.543Z
thnx @m1xolyd1an, a question, my application need connect with the api blockchain.com or can i only work bitcoin core?
Aisakk
CC BY-SA 4.0
2021-01-23T02:33:49.823Z
Yes you can build an application with just bitcoin-core.
m1xolyd1an
CC BY-SA 4.0
2021-01-22T02:35:18.570Z
2021-01-22T02:35:18.570Z
m1xolyd1an
<p>I am using the <code>easybitcoin.php</code> library and in my application. I use the <code>getreceivedbyaddress</code> method in php. It returns 0, but in my shell when I use bitcoin-cli it returns 0.000000000.</p>
<p>My question is, how can I return in php the same as the shell?</p>
<p>Tried this, <code>$ data2 = shell_exec ('bitcoin-cli getreceivedbyaddress address');</code> and it returns 0.00000000, but is there another way?</p>

<php>
Why the shell return the balance normal but php not?
Aisakk
# Why the shell return the balance normal but php not?

(Asked by: username_0 on 2021-01-21)

I am using the `easybitcoin.php` library and in my application. I use the `getreceivedbyaddress` method in php. It returns 0, but in my shell when I use bitcoin-cli it returns 0.000000000.

My question is, how can I return in php the same as the shell?

Tried this, `$ data2 = shell_exec ('bitcoin-cli getreceivedbyaddress address');` and it returns 0.00000000, but is there another way?

**Tags:** php


---

## 1 answers

### Answer by username_1 on 2021-01-22. Score: 1

I think this is more of a PHP question versus bitcoin, but that's how PHP handles a zero float. <https://www.php.net/manual/en/language.types.type-juggling.php>

```
$var = 0.00000000;
echo $var;
 

```

Returns:

```
0

```

If you want to force a zero value to eight decimals you can use `number_format()` <https://www.php.net/manual/en/function.number-format>

```
$var = 0.00000000;
$formatted = number_format($var, 8);
echo $formatted;
 

```

Returns:

```
0.00000000

```

> **Comments:**
> **username_0**: thnx @username_1, a question, my application need connect with the api blockchain.com or can i only work bitcoin core?  
> **username_1**: Yes you can build an application with just bitcoin-core.  

---

