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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:28:16+00:00 2026-06-04T23:28:16+00:00

here’s my issue: I have a program in the command line that has access

  • 0

here’s my issue:
I have a program in the command line that has access to tens of thousands of users. The idea is that you want to be able to get all the information about a user by simply inputting their username. So, because I want to work in php, I’ve done the following

$user_info = array();
exec('uwdir -v userid=nvidovic', $user_info); 

To give you an oversimplified version of what a var_dump on $user_info would look like, it would be something like this:

array(2){
  [0] => "first: N"
  [1] => "last: Vidovic"
} 

I’d like to be able to do this $user[first] => N

This is what I’ve come up with (not for the real data from command line):

$full_name = array("first: N", "last: Vidovic");
var_dump($full_name);
foreach ($full_name as $part_name) {
    $exploded = explode(":", $part_name);
    $make_array = array($exploded[0] => $exploded[1]);
    echo $make_array["first"]; 
}

Clearly, this doesn’t work. But my question is why? Does anyone know how I can do what I explained above?
I’m really, really, really…really stuck
THANKS to anyone in advance!!

EDIT:
Great answers, thank you. One last thing though, I keep getting the error messages Notice: Undefined offset: 1 and Notice: Undefined offset: 0 for the code below:

$user_info = array();
exec('uwdir -v userid=nvidovic', $user_info); 
foreach ($user_info as $info) {
    $exploded_info = explode(":", $info);
    $info_array[$exploded_info[0]] = $exploded_info[1];
}
echo $info_array["displayName"];

Anyone know why this is happening? I thought the explode function would break up the single string into an array of two strings, right?

  • 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-04T23:28:18+00:00Added an answer on June 4, 2026 at 11:28 pm
    $full_name = array("first: N", "last: Vidovic");
    //var_dump($full_name);
    foreach ($full_name as $part_name) {
        $exploded = explode(":", $part_name);
        $make_array[$exploded[0]] =  $exploded[1];
       // echo $make_array["first"]; 
    }
    print_r($make_array);
    

    http://codepad.org/JvcPdBeq

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

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
Here is the problem that I am trying to solve. I have two folders
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here's the setup - I have a view that lists products. On that same
Here's my situation. I have a DotNetNuke application. I want to link to an
Here is a scenario: User installs .NET application that you have made. After some
Here is my code...I have two dimensional matrices A,B. I want to develop the
Here is my code (Say we have a single button on the page that
Here's my scenario - I have an SSIS job that depends on another prior
Here's the context: I have a file (or stream), and I want to process

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.