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

  • Home
  • SEARCH
  • 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 7905997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T10:43:21+00:00 2026-06-03T10:43:21+00:00

I have a dynamic value that is being stored in a PHP variable. The

  • 0

I have a dynamic value that is being stored in a PHP variable. The variable holds a string of data that represents which check-boxes were clicked. It is returned like so: Option1, Option2, Option3, Option4…..

I would like to strip out the commas so it is just Option1 Option2 Option3 Option4….

My Code:

<?php 
    $type = the_field('type_of_work'); 
    $type = str_replace(",", "",$type);
    echo $type; 
?> 

For some reason, the commas are still being rendered. Any idea why or how I can fix this? Just so you know, the_field(‘type_of_work’) is a way to pull advanced custom fields from wordpress’ backend, but shouldn’t be relevant to this question as it is retuning a string with commas successfully. Any thoughts?

UPDATE: I am going about this a different way like so:

if(in_array('brand-id', get_field('type_of_work') )): 
    echo "brand-id";
endif; 

echo " ";

if(in_array('print', get_field('type_of_work') )): 
    echo "print";
endif;

so on….

  • 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-03T10:43:22+00:00Added an answer on June 3, 2026 at 10:43 am

    There is something else you are not including. The code you posted does it’s job perfectly. If you still see commas then something else is playing a part here.

    <?php 
        $type = the_field('type_of_work'); 
        $type = str_replace(",", "",$type);
        echo $type; 
    ?> 
    

    This is the prefect time to die so you know for sure.

    <?php
    die(str_replace(',', '',the_field('type_of_work')));
    ?> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have dropdown menu..which is dynamic.. How can get value of the last item
I have a Dynamic Data Entities Web Application that uses a database with GUIDs
Here is the problem. I have a stored procedure that transforms normalized data into
I have dynamic array filled with bytes, which are read from .raw file with
I have some divs that have dynamic heights controlled by a 'click' function as
I have some divs that have dynamic heights controlled by a 'click' function as
I have a dynamic SQL statement I've created in a stored procedure. I need
I have a dynamic text file that picks content from a database according to
I have a dynamic list of items that will be used to POST information
I have a reporting module (C# asp.net) that uses dynamic controls to represent the

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.