php echo to a variable code example Example 1: echo php <?php $string = "Hello, World!"; echo $string; ?> Example 2: print in php print_r("");