New course! Every coder should learn Generative AI!
Try a free lesson+ 1
you could use the "explode" function to split the string at whitespaces and then print every item.
For example:
<?php
//get the User Agent string
$useragent = $_SERVER['HTTP_USER_AGENT'];
//use "explode" to split the string at whitespaces
$useragent_array = explode(" ", $useragent);
//count the length of the array
$array_length = count($useragent_array);
//print every item of the array
for($i=0;$i<$array_length;$i++) {
print $useragent_array[$i];
//make a new line on the html page
print "<br>";
}
?>