Contact: aviboots(AT)netvision.net.il
39,880 questions
51,806 answers
573 users
$s = "programming"; $index = round(strlen($s) / 2); echo $s[$index - 1]; /* run: a */
$s = "python"; $len = strlen($s); $index = round($len / 2); if ($len % 2 == 1) { echo $s[$index - 1]; } else if ($len % 2 == 0) { echo $s[$index - 1]; echo $s[$index]; } /* run: th */