How can a string variable be converted into a double in PHP?

To convert a string variable into a double in PHP, you can use the built-in function `floatval()`. This function will parse the string and return a floating point number. You can then assign this value to a new variable of type double.

// String variable to be converted
$stringVar = "3.14";

// Convert string to double
$doubleVar = floatval($stringVar);

// Output the double variable
echo $doubleVar;