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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:17:30+00:00 2026-05-28T08:17:30+00:00

I have been trying to get this to work and can’t. I have a

  • 0

I have been trying to get this to work and can’t.

I have a string like pop.2,rundo.5,moti.3 and I am trying to get the pop, rundo, and moti into a min with an already populated associative array function.

The final result should look like or mirror,

$min = min($user['pop'], $user['rundo'], $user['moti']);

So far I have

$items = 'pop.2,rundo.5,moti.3';
// EXPLODE MINUS ITEMS
$minus = explode(',', $items);
// GET MINUS ITEMS AMOUNT
foreach($minus as $item) {
     $itemMinus[] = explode('.', $item);
}

This is as far as I got and am now stuck. I have tried several ways of doing it but to no avail.

I know I can get the values like so,

$itemMinus[0][0] // pop
$itemMinus[1][0] // rundo
$itemMinus[2][0] // moti

But I need to dynamically generate it as I could be putting in strings that have more values such as youdo.3,gate.3,hiya.4,moti.0,yellow.2.

Any ideas and thanks.

  • 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-28T08:17:31+00:00Added an answer on May 28, 2026 at 8:17 am

    You’re nearly there. Use list() to get the key and value:

    $itemsMinus = array();
    $items = 'pop.2,rundo.5,moti.3';
    // EXPLODE MINUS ITEMS
    $minus = explode(',', $items);
    // GET MINUS ITEMS AMOUNT
    foreach($minus as $item) {
        // Add to the array by key
        list($key, $value) = explode(".", $item); 
        $itemsMinus[$key] = $value;
    }
    
    print_r($itemsMinus);
    Array
    (
        [pop] => 2
        [rundo] => 5
        [moti] => 3
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to get it to work using this thread but can't
I have been trying everything I can to get this script to work and
I have been trying to get this to work correctly and I think I
I have been trying to get this jsfiddle to work. So far without luck.
This is crazy, I have been trying for hours to get this to work.
I have been trying to get this to work for 12 hrs now and
I have been trying to get this to work for about three solid days
I have been trying to get this query to work but I am stumbed
I’ve been trying to get this to work for a while but can’t (I
I have been trying to get this to work and I am nearly 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.