I want to print echo inside echo code

322 Views Asked by At

I am trying to modifi link in this line, can you help me?

/'. str_replace(' ', '+', $location).'/

code

this is the fals code:

/<?php echo  str_replace(' ', '+', <?php echo '$location';?>);?>/
1

There are 1 best solutions below

8
On

You can echo out the statement like so:

<link rel="shortcut icon" href="<?php echo $siteurl.'/'.$countrySelect.'/'.str_replace(' ', '+', $location).'/'.str_replace(' ', '+', $jobSelect).'-'.$lang['seo_url1']; ?>.html"/>

So if your code is something like so:

<?php
$siteurl = "http://google.com";
$countrySelect = "india";
$location = "north india";
$jobSelect = "software engineer";
$lang['seo_url1'] = "sample_url";
?>
<link rel="shortcut icon" href="<?php echo $siteurl.'/'.$countrySelect.'/'.str_replace(' ', '+', $location).'/'.str_replace(' ', '+', $jobSelect).'-'.$lang['seo_url1'];?>.html"/>

Your output will be :

<link rel="shortcut icon" href="http://google.com/india/north+india/software+engineer-sample_url.html"/>

UPDATE

also you should provide an icon file for shortcut icon not a html page.