Source: levelup.gitconnected.com

PHP 7.x — P3: Variables Intro

Category: PHP

You might remember that there are these things called x and y variables that used to store numbers.

Just substitute 2 for x and 5 for y and you get 7.

First, we’ll assign the string to the $name variable and then concatenate it to the “Hi my name is” string. You can’t just place the variable next to the string and expect PHP to understand that you want to join the two strings.

You can change the value of the $name variable to whatever you want and it will automatically update the output.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners