In PHP, single-quoted strings are not subject to variable expansion. The string literal '$IP'
represents a string containing three characters: $
, I
, and P
, in that order. ('$IP' === "\$IP"
)
You don’t need the quote characters at all. Just $IP
will suffice. If you want to use quote characters then you must use double quotes ("$IP"
), but there is no reason to do so when the only thing contained in the string is a variable — just use the variable. (This is not completely true: "$foo"
is a legitimate way to convert $foo
to a string, but that is not necessary here.)
1
solved Minecraft Server Pinger error [closed]