Is it possible to use PHP without a dollar sign $ character for variables?

Is it possible to list variables in a Java-like style in PHP, for example, removing the need for a character $every time? If so, how can I enable a setting that does this?

+3
source share
5 answers

No.

+64
source

Sorry, this is not possible. The closest you will get the constants:

define('CONS', 5);
echo CONS;
+6
source

, .

PHP, . , PHP $ , :

$bob = "rabbit"
$joe = "dragon-$bob"  // ==> dragon-rabbit

. Ruby, - , :

bob = "rabbit"
joe = "dragon-#{bob}"

Java (, Java, StringBuffer " + bob + "... , ).

, ( ).

, PHP- ( , ), , ... !

+4

. PHP $.

- .

+3

Java :

str = "some string";
System.out.print(str.contains("some"));

.

+3

Source: https://habr.com/ru/post/1705996/


All Articles