Echo variable outside function php?

For your function, use return instead of echo. Here is an example.

1
2
3
4
5
6
7
$item = explode($first_delimiter, $explode);						
$item = $item[1];
$item = explode('</td>', $item);
$item = strip_tags($item[0]);
 
 
return 'Type: '.$item.'<br>';

Then call the function like this:

2
3
4
$var = chars('arg');
 
echo ''.$var.'';

So your $var becomes the result / return of your function. You can then insert it into your database or tweak it further with explodes or whatever you like.

coding

ADD A COMMENT: