Numbers in a String in PHP

As you already know, strings can consist of digits. In this case, everything will work similarly:

php<?php
  $str = '12345';
  
  echo $str[0]; // will output '1'
  echo $str[1]; // will output '2'
  echo $str[2]; // will output '3'
?>

You can, for example, find the sum of the first two digits of our number and it will work:

php<?php
  $str = '12345';
  echo $str[0] + $str[1]; // will output 3
?>
Задание 1

Given a string '12345'. Find the sum of the digits of this string.