pimarc
pimarc

Reputation: 4145

echo in an echo

I have the 2 following echos :

<?php echo $data->county; ?>

This one gives me datas like "florida", "california"... from the database

and

<?php echo lang(california); ?>

This one gives me a translation from a lang.php file, for example :

'california'   =>   'La californie'

I would like to place the $data->county in the lang echo, I tried the following with no success :

<?php echo lang(.$data->county.); ?>

What's the error ? Is it possible to echo in an echo ?

Upvotes: 0

Views: 214

Answers (2)

gen_Eric
gen_Eric

Reputation: 227200

<?php echo lang($data->county); ?>

Lose the .s, they're for concatenating strings. You're just passing a string variable.

Upvotes: 4

Ry-
Ry-

Reputation: 224867

What made you think you needed the dots? Just pass it like any other argument:

<?php echo lang($data->county); ?>

Upvotes: 4

Related Questions