I have a php function that called in this way
breadcrumbs_func();
stamp this breadcrumbs:
<div class="breadcrumbs" itemscopeitemtype="http://schema.org/BreadcrumbList">
<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="#" itemprop="item"><span itemprop="name">Home</span></a>
<meta itemprop="position" content="nprog">
</span>
<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
<a href="#" itemprop="item" ><span itemprop="name">Category</span></a>
<meta itemprop="position" content="nprog">
</span>
</div>
When I call this function I want to replace the two content="nprog"
with a progressive number (1-2-3...) in this way:
content="1"
, content="2"
I tried with str_replace();
but it doesn't seem to work:
$breadcrumbs = breadcrumbs_func();
$new_breadcrumbs = str_replace("nprog", "1", $breadcrumbs);
echo $new_breadcrumbs;
this return the breadcrumbs with no changes.
Any help?