<?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));
- Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.32, 7.1.0 - 7.1.24, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- page0 ---> page1 ---> page2 ---> goal
preferences:
94.17 ms | 408 KiB | 5 Q