I just downloaded complete source code of PHP from php.net (PHP 5.4.0 [tar.bz2]). They are often using three curly brackets together as given below (The following code snippet extracted form ext/ctype/ctype.c.)
/* {{{ proto bool ctype_digit(mixed c) Checks for numeric character(s) */ static PHP_FUNCTION(ctype_digit) { CTYPE(isdigit); } /* }}} */
Does anyone have the idea why they are using these three curly brackets together?
Introduction. PHP allows both square brackets and curly braces to be used interchangeably for accessing array elements and string offsets. For example: $array = [1, 2]; echo $array[1]; // prints 2 echo $array{1}; // also prints 2 $string = "foo"; echo $string[0]; // prints "f" echo $string{0}; // also prints "f"
In PHP, elements can be added to the end of an array by attaching square brackets ([]) at the end of the array's name, followed by typing the assignment operator (=), and then finally by typing the element to be added to the array. So far in our PHP programming, we've been thinking about individual pieces of data.
Different programming languages have various ways to delineate the start and end points of a programming structure, such as a loop, method or conditional statement. For example, Java and C++ are often referred to as curly brace languages because curly braces are used to define the start and end of a code block.
The double curly brackets are not HTML but scripting code. The term inside, interest, is a placeholder, sort of like the name and address in a form letter. The string {{interest}} will be replaced when the HTML template is converted into straight HTML that is sent over the network to the user.
They are vim fold markers, they make it easy to collapse and expand the text inbetween the triple curly braces in vim, in the example shown alternating between:
... /* {{{ proto bool ctype_digit(mixed c) Checks for numeric character(s) */ static PHP_FUNCTION(ctype_digit) { CTYPE(isdigit); } /* }}} */ ...
and just
... /* {{{ proto bool ctype_digit(mixed c) ...
If you look at the end of the file where you find them, you'll often find a block like this:
/* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: sw=4 ts=4 fdm=marker * vim<600: sw=4 ts=4 */
Which is another more-obvious indicator that these comments relate to vim.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With