Câu hỏi phỏng vấn PHP
Câu hỏi

What does a $$...

Câu trả lời

In PHP, the use of multiple dollar signs ($$) is known as a "variable variable". It is a way to create a variable whose name is determined by the value of another variable.

Here's how it works:

  1. The first $ is used to define a variable, just like in a regular variable assignment.

  2. The second $ is used to indicate that the value of the variable should be treated as a variable name.

  3. If there are more than two $ signs (e.g., $$$), it means that the value of the variable is a variable that contains another variable name.

For example:

php Copy
$foo = "bar";
$$foo = "baz";

echo $foo;    // Output: bar
echo $bar;    // Output: baz

In this example:

  • ...
senior

senior

Gợi ý câu hỏi phỏng vấn

middle

What are some of the big changes PHP has gone through in the past few years?

senior

What is use of Spaceship Operator?

junior

Is multiple inheritance supported in PHP?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào