Contact: aviboots(AT)netvision.net.il
39,879 questions
51,805 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 */