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 1095211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:05:19+00:00 2026-05-17T00:05:19+00:00

I have this code: $array[] = <b> FLYDANNA&reg; HEADWRAP </b> <ul> <li type=\circle\><i> Sensational

  • 0

I have this code:

$array[] = "<b>  FLYDANNA&reg; HEADWRAP  </b>     <ul>  <li type=\"circle\"><i>  Sensational headwrap made from 6 pieces of fabric to fit the contours of your head perfectly  </i>  <li type=\"circle\"><i>  Strong yet lightweight cotton wrap can be folded up and stored almost anywhere-;pocket, purse, backpack ... you name it!  </i>  <li type=\"circle\">";

I want to remove all the html tags, remove excess spaces and add a double dash after the last capital word. Also, after every </li> tag I will add a period.

I need to format it before I put it in the array so the output must be:

$array[] = "FLYDANNA&reg; HEADWRAP-- Sensational headwrap made from 6 pieces of fabric to fit the contours of your head perfectly. Strong yet lightweight cotton wrap can be folded up and stored almost anywhere-;pocket, purse, backpack ... you name it!";

Thanks in advance 🙂

  • 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-05-17T00:05:19+00:00Added an answer on May 17, 2026 at 12:05 am

    Given the following:

    $str = "<b>  FLYDANNA&reg; HEADWRAP  </b>     <ul>  <li type=\"circle\"><i>  Sensational headwrap made from 6 pieces of fabric to fit the contours of your head perfectly  </i>  <li type=\"circle\"><i>  Strong yet lightweight cotton wrap can be folded up and stored almost anywhere-;pocket, purse, backpack ... you name it!  </i>  <li type=\"circle\">";
    

    This code should do the trick:

    $str = strip_tags( $str );
    $str = preg_replace( '/\s+/', ' ', $str );
    $words = array_reverse( explode( ' ', $str ) );
    foreach ( $words as $k => $s ) {
      if ( preg_match( '/\b[A-Z]{2,}\b/', $s ) ) {
        $words[$k] = $s . "--";
        break;
      }
    }
    
    $str = trim( join( ' ', array_reverse( $words ) ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
I have this code: $a = array ('zero','one','two', 'three'); foreach ($a as &$v) {
I have this code that converts an array of date strings from a format
I have this code: <?php $result_array1 = array(); $sql1 = SELECT * FROM `test_thing`;
so I have this code: $sql = new Zend_Db_Select($db); $sql->from(j); $sql->join(k,k.id = j.id,array()); echo
I have this code that should display a list of values from an array
I have this code: var a:Array = [ Ramsey, Tusey, Iuser,Sephora,'user', 'reseo', 'nesey', 'sela']
I have this code to sort an array of objects. The data in the
I have this code below: $insert = array(); for ($i = 1, $n =
i have this code that will check the array contains the specific string and

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.