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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:24:28+00:00 2026-06-09T17:24:28+00:00

For example, I have this text: <content>Foo</content>This is only a <b>test</b><content>Bar</content>Again, only a test.

  • 0

For example, I have this text:

<content>Foo</content>This is only a <b>test</b><content>Bar</content>Again, only a test.

How can I create an array with two entries, Foo and Bar?

  • 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-09T17:24:30+00:00Added an answer on June 9, 2026 at 5:24 pm
    preg_match_all("/<content>(.+?)<\/content>/is", $string, $matches);
    

    Your results will be put into the $matches array.

    Access them with $matches[0], $matches[1], and so on.

    Good luck!

    EDIT: preg_match_all() will give you all of the results! Thanks to @Blake for the tip.

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

Sidebar

Related Questions

I have a text that has multiple occurrences of variables in this format: Example
I have this example FactoryGirl.define do @site = FactoryGirl.create(:my_site) factory :user do email {
For example I have this HTML code: <div id=canvas> <div id=root> <div id=content> <span>
I have this PHP file: <?php header('Content-type: text/xml; charset=UTF-8'); ?><?xml version=1.0 encoding=UTF-8 ?> <Module>
I have implemented master pages using this example How to implement a status bar
I have the text (code for Python 2.6): txt=foo<br><br><b>bar :</b><br>foo<br><b>bar :</b> Then I tried
For example i have this xml. I need to get value of parameter val
For example we have this line chart at Google Code API there is a
OK. For example I have this line in my txt file: 1|1,12;7,19;6,4;8,19;2,2 As you
How would I split a node/element at a position (selection). Example I have this

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.