Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php function bigSum(string $a, string $b): string { $a_arr = array_reverse(str_split($a)); $b_arr = array_reverse(str_split($b)); $res = []; $l = max(count($a_arr), count($b_arr)); for ($c=0; $c<$l; $c++) { $r = ($a_arr[$c] ?? 0) + ($b_arr[$c] ?? 0); if ($r < 10) $res[] = $r; } return implode('', array_reverse($res)); } echo bigSum('1000000000000000000000000000001','465');
Copy Clear