Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the first two numbers in an integral?

Tags:

javascript

php

How to get the first two numbers in an integral?

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

like image 376
lovespring Avatar asked May 12 '10 08:05

lovespring


People also ask

What do the numbers on top of the integral mean?

These are called the the limits of integration, the top one is known as the uppper limit and the bottom one is the lower limit. Essentially, these numbers are substituted into the integral after the integration has been performed. For example.

How do you find the integral of two points?

The area under a curve between two points can be found by doing a definite integral between the two points. To find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.

What do the top and bottom numbers on an integral mean?

The number at the bottom of the integral sign is called the lower limit of integration, while the number at the top of the integral sign is called the upper limit of integration. When the area between the function and the horizontal axis isn't made up of nice shapes, it's harder to find the integral.


2 Answers

PHP:

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

JavaScript:

alert((123456).toString().substr(0, 2));
like image 107
Sarfraz Avatar answered Nov 06 '22 00:11

Sarfraz


JavaScript:

(123456).toString().substr(0,2);

PHP:

substr(123456, 0, 2);
like image 31
Delan Azabani Avatar answered Nov 05 '22 23:11

Delan Azabani