<?php $kalimat = "Belajar php di myphptutorials"; $kata_array = explode(' ',$kalimat); $kalimat_baru = ''; $i=1; foreach($kata_array AS $kata_array1){ if ($i<=2) $kalimat_baru .= $kata_array1.' '; $i++; } echo $kalimat_baru; ?>