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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:54:53+00:00 2026-06-14T22:54:53+00:00

I have string from mysql in this format 1.name.2.name,3.name.8.name I have this $arr=split(,,$str);$count=count($arr); this

  • 0

I have string from mysql in this format

1.name.2.name,3.name.8.name

I have this

$arr=split(“,”,$str);$count=count($arr);

this will make 2 arrays, but I want to write it itemized

for ($i=0;$i<$count;$i++){
echo $arr[$i];
// when $i=0 here must be 1 name 2 name and when $i=1 3 name 8 name
}

this is still right, but now I want inside loop write values from $arr[$i], I need to split them by dott. Is it possible?

  • 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-14T22:54:55+00:00Added an answer on June 14, 2026 at 10:54 pm

    You don’t need any loop

    $string = "1.name.2.name,3.name.8.name";
    $array = explode(",", $string);
    var_dump($array);
    

    Output

    array (size=2)
      0 => string '1.name.2.name' (length=13)
      1 => string '3.name.8.name' (length=13)
    

    If you want to break it further

    $array = array_map(function($v){return explode(".", $v); },$array);
    var_dump($array);
    

    Output

    array (size=2)
      0 => 
        array (size=4)
          0 => string '1' (length=1)
          1 => string 'name' (length=4)
          2 => string '2' (length=1)
          3 => string 'name' (length=4)
      1 => 
        array (size=4)
          0 => string '3' (length=1)
          1 => string 'name' (length=4)
          2 => string '8' (length=1)
          3 => string 'name' (length=4)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below string String str=select * from m_menus; select * from m_roles; I
I have a string built from a few segments, which are not separated, but
I have a string read from another source such as \b\bfoo\bx. In this case,
Possible Duplicate: remove duplicate from string in PHP Have a string like: $str =
I have a table that contains company names in this format: Name Name ,
HI, I have some string from XML file, and I I want to replace
I have a string input from which I need to extract simple information, here
I have a formatted string from a log file, which looks like: >>> a=test
I have a string value from a user input box. I have to figure
I have a string returned from server with encoded HTML tags. I use 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.