0

for example i have this input in my form 12345,6789,1011 and i want to get their first number the output should be like this 1 6 1 just want to get all the first number of separated comma in my code all I'm getting is the first part of the number 12345 = 1 couldn't get the other number that is separated by comma, thanks in advance for the help.

NewbieDev
  • 15
  • 4

1 Answers1

0

You can do like below:

<?php
$string = "12345,6789,1011";
$result = explode(",",$string);
$ConcatString = '';
foreach($result as $Values)
{
    $ConcatString .= $Values[0]." ";
}
echo $ConcatString;
?>

Output will be 1 6 1

Amit Gupta
  • 2,771
  • 2
  • 17
  • 31