problem with converting array, implode function doesn’t work

Hi i'm trying to convert array values to simple strings but i can't. I tried the function implode (), serialize (), join (), but nothing I can't. This is the array values (hyperlink) that i want to convert into text.

enter image description here

This is my full code:

$dom = new DOMDocument;
libxml_use_internal_errors(true);
$dom->loadHTML($CasermaUtente);
$xpath = new DOMXPath($dom);
$texts = [];
$count = 0;
foreach ($xpath->query("//table[contains(@class, 'troop_details') and contains(@class, 'inReturn')]") as $table) {
  $tablePath = $table->getNodePath();
   $texts[] = [
        $xpath->query($tablePath . "//td[@class='troopHeadline']//a[@href]/text()")[0]->nodeValue
  ];
  $orario[] = [
        substr($xpath->query($tablePath . "//div[@class='at']/span[starts-with(text(), 'at')]/text()")[0]->nodeValue, -8)
  ];
$count = $count + 1;
}
?>

<table width="350px" border="1">

<?php
for ($i=0; $i<$count ; $i++) { ?>
<tr><td><?php $stampa_stringa = implode($texts[$i]);
echo $stampa_stringa; ?>
</td>
<td align="center"> <?php $stampa_orario = implode($orario[$i]);
echo $stampa_orario; }?>
</td>

</table>


Read more here: https://stackoverflow.com/questions/66276720/problem-with-converting-array-implode-function-doesnt-work

Content Attribution

This content was originally published by Luigi at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: