i used this code but some thing wrong.  

i show only last three number show using php in javascript.

```js
var number = "678342345"
function substr() {
var numbersub = <?php
$rest = substr(number, -3);
echo $rest;
?>
document.getElementById("nember").innerHTML = numbersub;
};
```

```html
<button class="buttonsa" onclick="substr()">Show Number</button>
<br>
<div id="nember"></div>
```