Skip to content

Error on string interpolation with double quotes #91

@Sjord

Description

@Sjord
<?php
$a = ["planet" => "world"];
echo "hello {$a["planet"]}";

Expected:

(program [0, 0] - [4, 0]
  (php_tag [0, 0] - [0, 5])
  (expression_statement [1, 0] - [1, 27]
    (assignment_expression [1, 0] - [1, 26]
      left: (variable_name [1, 0] - [1, 2]
        (name [1, 1] - [1, 2]))
      right: (array_creation_expression [1, 5] - [1, 26]
        (array_element_initializer [1, 6] - [1, 25]
          (string [1, 6] - [1, 14])
          (string [1, 18] - [1, 25])))))
  (echo_statement [2, 0] - [2, 28]
    (string [2, 5] - [2, 27])))

Actual:

(program [0, 0] - [4, 0]
  (php_tag [0, 0] - [0, 5])
  (expression_statement [1, 0] - [1, 27]
    (assignment_expression [1, 0] - [1, 26]
      left: (variable_name [1, 0] - [1, 2]
        (name [1, 1] - [1, 2]))
      right: (array_creation_expression [1, 5] - [1, 26]
        (array_element_initializer [1, 6] - [1, 25]
          (string [1, 6] - [1, 14])
          (string [1, 18] - [1, 25])))))
  (echo_statement [2, 0] - [2, 28]
    (string [2, 5] - [2, 17])
    (ERROR [2, 17] - [2, 27]
      (name [2, 17] - [2, 23])
      (string [2, 23] - [2, 27]))))
fail/rb.php	0 ms	(ERROR [2, 17] - [2, 27])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions