N
N
newaitix2018-02-07 22:49:09
PHP
newaitix, 2018-02-07 22:49:09

Get an array property inside an object?

$prefix1='88Qn|Q*wcIa5';
$prefix2='66{Rvi#wy?r?#1';
$arr=[
  'prefix1'=>'88Qn|Q*wcIa5',
  'prefix2'=>'66{Rvi#wy?r?#1',
  'encode'=>"$prefix1$prc$prefix2"
];

How can I replace "$prefix1$prc$prefix2" with something like this to take values ​​from an array and not variables?
this['prefix1'].$prc.this['prefix2']

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ivankomolin, 2018-02-08
@ivankomolin

$prc = '';
  $arr=[
    'prefix1' => '88Qn|Q*wcIa5',
    'prefix2' => '66{Rvi#wy?r?#1',
  ];

  $arr['encode'] = $arr['prefix1'] . $prc . $arr['prefix2'];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question