PHP7 DATA TYPES INTEGERS FLOATS STRINGS BOOLEAN LESSON 10

Strings in PHP7

If you have been following along in our lessons we have used several strings. A string in PHP can be encapsulated with single or double quotes. A PHP string is made up of several letters, numbers and even code like HTML, javaScript and CSS. Here is an example of a string.

<?php $var="I Love PHP7" var_dump($var);?>

This is the result. When you use var_dump it returns the value and also the number of characters that are in a string.

string(11) “I love PHP7”

Using Strings With Code in PHP7

You can use strings to hold code in PHP. We have done this a few times already in our lessons. Here is an example.

Only cool people share!

<?php $string='
<h3>PHP7 Is Awesome</h3>';
echo $string; ?>

When Would I Use String in PHP7?

You will use strings all the time in PHP7. They are used everywhere and practically on every page. Creating a string is simple and easy to use, that may be why we use them so often.

string in php7 are used all the time

PHP7 DATA TYPES INTEGERS FLOATS STRINGS BOOLEAN LESSON 10 was last modified: October 29th, 2021 by Maximus Mccullough
PHP7 DATA TYPES HOW THEY ARE USED

Pages:Previous 1 2 3 4 Next

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.