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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:03:32+00:00 2026-06-06T18:03:32+00:00

I want to remove the whitespace between the arrays, but I’ve used different codes

  • 0

I want to remove the whitespace between the arrays, but I’ve used different codes like trim but it does not remove. I think because trim is fro ” ” outside space and not between the words itself. I’m using PHP.

This is for R, but something like this: How to remove all whitespace from a string?

I’ve changed my code to this:

<?php

function combinations($arr, $n)
{
    $res = array();

    foreach ($arr[$n] as $item)
    {
        if ($n==count($arr)-1)
            $res[]=$item;
        else
        {
            $combs = combinations($arr,$n+1);

            foreach ($combs as $comb)
            {
                $res[] = "$item $comb";
            }
        }
    }
    return $res;
}

$words = array(array(
'PY7AD022031',
'AD022031',
'CB5A09XQXU',
),array(
'HELLO', 
'3040',
'3022031',
'07W11',
'4170B',
'0682',
'35570401',
'103448',
), array(
'HELLO', 
'3040',
'3022031',
'07W11',
'4170B',
'0682',
'35570401',
'103448',
));

$combos = combinations($words,0);  

$comma_separated = implode("<br />", $combos);
print("<pre>".print_r($comma_separated,true)."</pre>");
//var_dump($combos);
?>

It echo’s

PY7AD022031 HELLO HELLO
PY7AD022031 HELLO 3040
PY7AD022031 HELLO 3022031
PY7AD022031 HELLO 07W11
PY7AD022031 HELLO 4170B

But I want

PY7AD022031HELLOHELLO
PY7AD022031HELLO3040
PY7AD022031HELLO3022031
PY7AD022031HELLO07W11
PY7AD022031HELLO4170B
  • 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-06T18:03:33+00:00Added an answer on June 6, 2026 at 6:03 pm

    it’s simple just change your syntax

    $res[] = "$item $comb";
    

    into this syntax :

    $res[] = "$item$comb";
    

    remove whitespace in your $res.

    have you try it?


    http://nanamo3lyana.blogspot.com/

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

Sidebar

Related Questions

So i want to remove empty items in listbox like whitespace so Far I
I want to remove the decimal part of a number in a cell but
I want to remove an item from ListView , but I don't know how
I'm having a CSV like this. john,joy, anna, Lucy Bravo,boy I want to remove
I want to remove the leading and trailing whitespace from string: String s =
I want to remove quotes in a string when there are no whitespaces between
I'm making a console calculator, and I want to remove any whitespace that the
I want to remove all whitespace characters from a multi-line string using regex. What
I want to remove all the whitespace i..e tabs/spaces/newline chars. T = {xmlelement,presence, [{xml:lang,en}],
I want to remove square brackets from an SQL string, but only where there

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.