How does PHP handle data types when converting strings to numeric values?

When converting strings to numeric values in PHP, it is important to be aware of how PHP handles data types. PHP will automatically convert a string to a numeric value if it starts with a numeric character. However, if the string contains non-numeric characters or is an empty string, PHP will return 0 as the numeric value. To avoid unexpected results, it is recommended to use the `intval()` or `floatval()` functions to explicitly convert strings to integers or floats.

$string = "123";
$numericValue = intval($string);
echo $numericValue; // Output: 123