Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8119355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:46:52+00:00 2026-06-06T04:46:52+00:00

H everyone, I have the following: $html = ‘<ul class=pagination-all>’; $html .= ‘<li class=pagination-start><div

  • 0

H everyone,

I have the following:

$html = '<ul class="pagination-all">';
    $html .= '<li class="pagination-start"><div class="img-start"></div>'.$list['start']['data'].'</li>';
    $html .= '<li class="pagination-prev"><div class="img-prev"></div>'.$list['previous']['data'].'</li>';
    $html .= '<ul class="pagination-data">';
    foreach($list['pages'] as $page) {
        $html .= '<li>'.$page['data'].'</li>';
    }
    $html .= '</ul>';
    $html .= '<li class="pagination-next">'. $list['next']['data'].'<div class="img-next"></div></li>';
    $html .= '<li class="pagination-end">'. $list['end']['data'].'<div class="img-end"></div></li>';
    $html .= '</ul>';

    return $html;

I was wondering how to make it so if it finds Start , string replaces “img-start” to “img-start-active”. If it finds span class=”pagenav”> End , string replaces “img-end” to “img-end-active”.

I attempted:

$string = $html;
if(strstr($string, '<span class="pagenav"> Start </span>'))
{
echo str_replace("img-start", "img-start-active", $string);
}
else
{
echo " ";
}

Unfortunately, I don’t believe I used this properly. What ended up was – while I got the desired string replacement given the condition, it echoed the whole pagination but without the formatting.

This is the image:enter image description here

So it was a mess.

Is there a way to do this search and replace but without creating a second “pagination”?

Answer:

 $string = $html;
        if(strstr($string, '<span class="pagenav">Start</span>'))
        {
        return str_replace("img-start", "img-start-active", $string);
        }
        else
        {
        echo " ";
        }

Remove return $html;

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:46:54+00:00Added an answer on June 6, 2026 at 4:46 am
    $string = $html;
        if(strstr($string, '<span class="pagenav">Start</span>'))
        {
        return str_replace("img-start", "img-start-active", $string);
        }
        else
        {
        echo " ";
        }
    

    Remove return $html;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everyone and thanks in advance for reading this.. I have the following html
I have a simple question. I have the following html code <a href=# class=purchase>
I have the following HTML and jQuery code: <div id=outer> <p> <p>paragraph inside division.</p>
I have created a jquery dropdown menu with the following HTML: <dl class=dropdown> <dt><a
Hello everyone, I have some confusion regarding some Win32 API data types and macros
I have the following in an html form using method Post. <input type=submit title=
I have the following code: $.getJSON('data.json', function(data) { var items = []; $.each(data, function(key,
Lets say you have lots of html, css, js, img and etc files within
Hey everyone, I have the following 'users' table in MySQL: CREATE TABLE `users` (
Everyone, I'm using MVC 3 (Razor). I have the following problem: I have some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.