Contact: aviboots(AT)netvision.net.il
40,029 questions
51,987 answers
573 users
$s = "php java c# python c"; $arr = explode(' ', $s, 2); $first_word = $arr[0]; echo $first_word; /* run: php */
$s = "php java c# python c"; $arr = preg_split('/ +/', $s, 3); $first_word = $arr[0]; echo $first_word; /* run: php */
$s = "php java c# python c"; $first_word = substr($s, 0, strpos($s, ' ')); echo $first_word; /* run: php */