Website Development Prices

Search Blog

Friday, May 8, 2015

Promenljive promenljivih (Variables variables)

Promenljiva promenljiva je ona koja sadrzi naziv promenljive. Prvo kreirate promenljivu.

<?php

$motora = 4

?>

Zatim kreirate novu promenljivu sa imenom $plavihMotora. U nju cemo staviti naziv promenljive $suzuki.

<?php

$motora = 4
$plavihMotora = "motora"

?>

Promenljivoj $motora pristupate preko $$plavihMotora.


<?php

$motora = 4;
$plavihMotora = "motora";

echo "Broj motora: ", $$plavihMotora;

?>

Variable variable is the one that contains the variable name. First you create a variable.

<? php

$motobike = 4

?>

Then create a new variable named $blueMotobikes. In that variable we will put the name of the variable $suzuki.

<? php

$motobike = 4
$blueMotobikes = "motobike"

?>

The variable $ Motor access using $$ plavihMotora.

<? php

$motobike = 4;
$blueMotobikes = "motobike";

echo "Number of motobikes: ", $$blueMotobikes;


?>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.