1// in case the number is a string
2$s = '123';
3$a = $s[0];
4echo $a; // 1
5
6// in case the number is an integer
7
8// Possibility 1
9$k = 123;
10$s = $k.''; // or: $s = (string)$k;
11$a = $s[0];
12echo $a; // 1
13
14// Possibility 2
15$k = 123;
16$a = floor($k/100);
17echo $a; // 1
18
19// Possibility 3
20$k = 123;
21$a = substr($k, 0, 1);
22echo $a; // 1