Once you make explode
becomes an array, and the error it gives you is trying to show an array with echo
, you have to go through it with a loop:
for ($i=0; $i<count($categoria); $i++) {
echo $categoria[$i];
}
If you are looking for a specific parameter, for example 1222 in 'folder / 1222 / hi-world', you do the echo of that position.
echo $categoria[1];
To show the first two elements of the previous example:
$url = $categoria[0]."/".$categoria[1];
echo $url;
Show URL joining two variables , edit to show comments.
After explode unes the elements you need from the array and the product. Check that the positions are correct, and keep in mind that if you change to a different environment than the tests can change.
<?php
$urlproducto = $_GET['url'];
$carpetas = $_GET['cat'];
$categoria = explode('/', $carpetas);
$url = $categoria[7]."/".$categoria[8]."/".$categoria[9]."/".$urlproducto;
echo $url;
?>