- var_dump: documentation ( source)
<?php
// HEAD
$element = [];
$text = $element['#text'];
var_dump($text);
// Using ??
$element = [];
$text = $element['#text'] ?? '';
var_dump($text);
// Using string cast no #text
$element = [];
$text = (string) $element['#text'];
var_dump($text);
// Using string cast with #text
$element = ['#text' => NULL];
$text = (string) $element['#text'];
var_dump($text);