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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:50:13+00:00 2026-06-11T13:50:13+00:00

When renumbering an array using $arr=array_values($arr); // Renumber array I realized that a line

  • 0

When renumbering an array using

$arr=array_values($arr); // Renumber array

I realized that a line break is being introduced into one of the array strings, which I don’t want.

My string is going from:

Property
Type

to Property

Type

In any case I am using:

$newelement = preg_replace("/[^A-Za-z0-9\s\s+]/", " ", $element);

already to remove unwanted characters prior to database insertion, so I tried to change it to:

 $newelement = preg_replace("/[^A-Za-z0-9\s\s+'<br>''<br>''/n''/cr']/", " ", $element);

But there is no change, and the ?line feed/line break/carriage return is still there.

Am I doing the preg_replace call correctly?

  • 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-11T13:50:15+00:00Added an answer on June 11, 2026 at 1:50 pm

    That preg looks a bit complicated. And then you have ^ in the beginning as not A-Z… or linefeed. So you don’t want to replace linefeed?

    How about

    $newelement = preg_replace("/[\n\r]/", "", $element);
    

    or

    $newelement = preg_replace("/[^A-Za-z ]/", "", $element);
    

    \s also matches linefeed (\n).

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

Sidebar

Related Questions

I have an array I'm using as a stack to store a path through
I have been working using openFrameworks, on a problem that is posted on the
Let's say I have a dynamic array that is populated on page load with
Having spent some time migrating old data into a new drupal site, my first
In my app i need to use something that will let the user select
i have noticed that every area has some tools you can use to make
I have two <select>s with the same <option>s , and I need - using
I have an array which may contain numeric or associative keys, or both: $x
A client of mine accidentally deleted about 500 records from an access table that
I often find myself remembering the name of a class that I want to

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.