How can you display only numbers before the comma in PHP?

To display only numbers before the comma in PHP, you can use the explode() function to split the string by the comma and then access the first element of the resulting array. This will give you the numbers before the comma.

$string = "123,456";
$numbers_before_comma = explode(",", $string)[0];
echo $numbers_before_comma;