To display the data value of a variable or a string, you can use the command echo or print . Different from the second command is a command print can behave like a function so that when you try the following script:
$Value = print “Learning PHP”;print $value;?>
Then the value that appears is 1. While the echo command more simple and faster because just write something directly to the browser.
There is one more commands that can be used to display data to the screen printf . Command printf is more complex because we can enter values dynamically and displays data of the type that we want. For more details, please try the following script:
printf (“%d <br>”,$p);
printf (“%d <br>”,$s);
printf (“%f <br>”,$d);
printf (“%d <br>”,$f);
In the above display, the fourth line should double data type but because of the type of data to be shown is an integer, then only the value of the integer data are displayed on the screen. The following table of some code and the functions that can be used on printah printf.
Next you can learn PHP configuration.
Spread the love