[TASK] Use $x[n] instead of substr($x, n, 1)