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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:29:41+00:00 2026-05-30T18:29:41+00:00

I have three variables that may or may not contain data. let’s call them

  • 0

I have three variables that may or may not contain data.

let’s call them $name, $address and $telephone.

Let’s say I want to combine them all into one var, $contact, each on a separate line.

$contact = $name.'<br />'.$address.'<br />'.$telephone;

$contact then gets put into an array. That array eventually goes through a foreach loop, not handling any vars that are equal to ''. How do I tell if the string is empty other than the two <br /> tags? I’ve tried copying $contact to $test_contact and running str_replace('<br />', '', $test_contact; but even when all the vars have been set to '' $test_contact == '' still evaluates to false. I’ve also tried trim() after str_replace() but that doesn’t seen to work either. I’ve also tried using === but again, no luck.

What am I missing? Is there a better way to do this?

Mark

  • 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-30T18:29:43+00:00Added an answer on May 30, 2026 at 6:29 pm

    check before inserting:

    if ($name.$address.$telephone == '')

    then is empty

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

Sidebar

Related Questions

I try to validate fields. Three fields that may only contain numbers. The fields
I have a javascript file that reads another file which may contain javascript fragments
This command line parses a contact list document that may or may not have
Suppose that I have those three files: a.h //a.h header #include <stdio.h> int int_variable;
I have a program, and in that program there is some variables (username and
I have three tables: page, attachment, page-attachment I have data like this: page ID
I have three tables tag , page , pagetag With the data below page
I know that the .NET memory model (on the .NET Framework; not compact/micro/silverlight/mono/xna/what-have-you) guaranteed
Is there any way that you may create a puzzle of three pieces with
I have a large data.frame that was generated by a process outside my control,

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.