Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php code explanation Reply To: php code explanation

#240779
I.m.learning
Participant

Anything that begins with a dollar sign is a variable. From your example, $content is being used as a recursive code

To explain recursive, if you don’t already know:
PHP is recursive; it stands for PHP: Hypertext Preprocessor

Another example is the name BRIAN as a recursive acronym
Brian
Really
Is
A Noun

Variable example:
<?php
$txt = “Hello world!”;
echo $txt;
?>

The result is: Hello world!

The forward arrow is used when referring to the attributes of an instantiated object.

This calls a function:
$variable->my_function();

This accesses a property:
$variable->name = ‘property’;

Curly braces = Complex (curly) syntax:

http://php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Any scalar variable, array element or object property with a string representation can be included via this syntax. Simply write the expression the same way as it would appear outside the string, and then wrap it in { }.

PHP.net is a really confusing site for some explanations; however, there are always examples to view for a visual aid.