1phpCopy<?php
2$variable = 10;
3$string1 = strval($variable);
4echo "The variable is converted to a string and its value is $string1.";
5?>
6
1phpCopy<?php
2$variable = 10;
3$string1 = (string)$variable;
4echo "The variable is converted to a string and its value is $string1.";
5?>
6
1phpCopy<?php
2$variable = 10;
3$string1 = "The variable is converted to a string and its value is ".$variable.".";
4echo "$string1";
5?>
6
1phpCopy<?php
2$variable = 10;
3$string1 = "".$variable;
4echo "$string1";
5
6$string1 = $variable."";
7echo "$string1";
8
9?>
10
1phpCopy<?php
2$variable = 10;
3echo "The variable is converted to a string and its value is $variable.";
4?>
5