Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Variables that will be expanded in double quoted strings are not parsed as variables #34

@Ben3eeE

Description

@Ben3eeE

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

Program:

<?php
$juice = "apple";

echo "He drank some $juice juice.".PHP_EOL;
// Invalid. "s" is a valid character for a variable name, but the variable is $juice.
echo "He drank some juice made of $juices.";
// Valid. Explicitly specify the end of the variable name by enclosing it in braces:
echo "He drank some juice made of ${juice}s.";
?>

Output:

He drank some apple juice.
He drank some juice made of .
He drank some juice made of apples.

Parser:
All of these variables are parsed as string:

text.html.php
program
echo_statement
string

Version:
0.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions