Inserting Associative Array Elements in PHP

However, inserting elements of associative arrays will not work like this:

php<?php
  $arr = ['a'=>1, 'b'=>2, 'c'=>3];
  echo "xxx $arr['a'] yyy"; // does not work
?>

To insert such elements, they must be wrapped in curly braces:

php<?php
  $arr = ['a'=>1, 'b'=>2, 'c'=>3];
  echo "xxx {$arr['a']} yyy";
?>

Alternatively, you can remove the single quotes from the key during insertion:

php<?php
  $arr = ['a'=>1, 'b'=>2, 'c'=>3];
  echo "xxx $arr[a] yyy";
?>

Sometimes it makes sense to simply write an array element into a variable in order to then easily insert the variable into the string:

php<?php
  $arr = ['a', 'b', 'c'];
  $elem = $arr['a'];
  
  echo "xxx $elem yyy";
?>
Задание 1

Simplify the following code:

php<?php
  $arr = ['a' => 1, 'b' => 2, 'c' => 3];
  echo 'text ' . $arr['a'] . ' text ' . $arr['b'] . ' text';
?>