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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:21:08+00:00 2026-06-09T20:21:08+00:00

Im looking for a way to take a php array and pass the values

  • 0

Im looking for a way to take a php array and pass the values between a couple of array keys and save into a string.

$array1 = array(0=>'sometext',
                1=>'1703',
                2=>'North',
                3=>5th',
                4=>'st',
                5=>'sometext')


I know the starting key and the end key in my script
$startnum = 1;
$endnum  = 4;
I need to get this
$string = '1703 North 5th st'

without changing the keys in the array because i have to iterate over the array again later. I am currently using array splice but it removes the items and key in the array so when i iterate over the array again the keys and values are all messed up. Please let me know if i need a better explanation.

  • 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-09T20:21:09+00:00Added an answer on June 9, 2026 at 8:21 pm

    Get the segment of interest using array_slice, then collapse it using implode:

    $string = implode(' ', array_slice($array1, $startnum, $endnum-$startnum));
    

    Note that array_slice takes an offset and a length, so the length is computed as the end less the start.

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

Sidebar

Related Questions

I am looking for a way to take a snapshot of ALL of a
I have SQL Server 2005 and I am looking for a way to take
I'm looking form a programatic way to take an integer sequence and spit out
I am looking for a smart way to take care of scheduling backups on
I am looking for a way to improve the workflow in a PHP based
Wonder if anyone can help, I'm looking for a way to take an image
I am looking for a way to take a model of a building and
I am currently looking for a way to take a variable in batch and
Basically I'm looking to create a page using PHP that will take SQL input,
What is the best way to take a given PHP object and serialize it

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.