How to truncate the value of a variable by sign?

Good day to all.

There is a variable that is equal to some number (or even a word).

$a = 1234567890;

I want to give another variable the same value, but from a certain to a certain sign from its beginning. For example

$b = " ____($a) "

i.e. what would happen that

$b = 34567

Prompt a command. Thank you in advance.


Answer 1, authority 100%

$from = 3;
$to = 7;
$num = $to - $from; // 
$b = substr($a, $from); // 3..strlen($a)
$b = substr($a, $from, $num); // 3..7
$b = substr($a, -5, 2); // (strlen($a)-5)..(strlen($a)-3)