- array_search: documentation ( source)
- array_slice: documentation ( source)
- implode: documentation ( source)
<?php
$arr[0]="page0";
$arr[1]="page1";
$arr[2]="page2";
$arr[3]="goal";
$arr[4]="page4";
echo implode(" ---> ", array_slice($arr, 0, array_search("goal",$arr)+1));