ungültige variable in variable

Sack

Sigma Hydrae
ID: 232829
L
20 April 2006
5.162
320
Moin,
probier mich im moment ein wenig in PHP und hab jetzt (mal wieder) ein frage:

wie kann man nochmal in PHP was ungültig machen?
Also ich möchte mit fwrite eine variable schreiben, in der eine Variablendefinition steht
PHP:
$var=$var2=$var3;;

ich möchte also das $var das schreibt:
PHP:
$var2=inhaltvonvar3;
ich hatte irgendwas mit slash in erinnerung
(also so oder so:$var=/$var2=$Var3;; ) aber das funktioniert natürlich -.- nicht.
Wie wäre es richtig?

Danke :D
 
Zuletzt bearbeitet:
Du meinst vermutlich Escapen ;)
PHP:
$foo = 'bar';
echo "\$foo=$foo";
Du solltest vor dem Rumprobieren die Grundbegriffe der Syntax im Manual nachlesen und lernen.
 
Printing dollar signs ($) in PHP can be difficult as they are used to
denote variables. In a double quoted string (where variables are
expanded) you need to escape the dollar sign as \$ like this:

$money = sprintf ("%01.2f", $bal_fwd);
$statement .= "\nBalance Brought Forward: \$$money\n";

Or, you can use single quoted string concatenated with the variable:

$statement .= "\n".'Balance Brought Forward: $'.$money."\n";

Note that the \n newlines also have to be in double quoted strings to be
expanded.

Regarding formatting the currency number, see the number_format
function.
Von faqts.com