A
A
Alexander2015-11-02 20:30:28
Yii
Alexander, 2015-11-02 20:30:28

What is the right way to concatenate?

<?php echo $modelAbout->customer_ . Yii::$app->language; ?>

Error : Getting unknown property: app\models\About::customer_
What is the right way to concatenate ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2015-11-02
@kentuck1213

echo $modelAbout->{'customer_' . Yii::$app->language};

I
inDeepCode, 2015-11-02
@inDeepCode

So:

<?php echo $modelAbout->customer_Yii::$app->language; ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question