Organizational Research By

Surprising Reserch Topic

How to get the first two numbers in an integral?


How to get the first two numbers in an integral?

For example: get 12 of the 123456 in PHP or JavaScript?

asked Apr 22, 2015 in PHP by rajesh
0 votes
19 views



Related Hot Questions

1 Answer

0 votes

PHP:

$num = 123456;
echo substr($num, 0, 2);

JavaScript:

alert((123456).toString().substr(0, 2));
answered Apr 22, 2015 by rajesh

...