<?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 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- 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] =>
)
preferences:
240.18 ms | 407 KiB | 360 Q