3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $newstring = 'Volvo Trucks - Rajnikanth - The Epic Split feat. (Live Test 6) @xyz Thalaivar Epic Split Rajanikanth Rajinikanth Rajani Auto Auto rikshaw and also @xyz.abc http://another.net @bac.def this is tesging @pqr '; $array = explode(" ", $newstring); $result=array(); foreach($array as $key=>$value) { if( strpos($value, '@', 0) == 0) $result[$key] = $value; } $result = array_values($result); print_r($result); ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Volvo [1] => Trucks [2] => - [3] => Rajnikanth [4] => - [5] => The [6] => Epic [7] => Split [8] => feat. [9] => (Live [10] => Test [11] => 6) [12] => @xyz [13] => Thalaivar [14] => Epic [15] => Split [16] => Rajanikanth [17] => Rajinikanth [18] => Rajani [19] => Auto [20] => Auto [21] => rikshaw [22] => and [23] => also [24] => @xyz.abc [25] => http://another.net [26] => @bac.def [27] => this [28] => is [29] => tesging [30] => @pqr [31] => )