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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:09:23+00:00 2026-05-11T16:09:23+00:00

What I am trying to do is the following: I have an array of

  • 0

What I am trying to do is the following: I have an array of values, these values will eventually be used to generate a random unique string but that’s a little later. First I would like to loop through all the values in the array (foreach loop) then I would like to limit this (while loop) Is this a correct method for doing this?

The below code does not work, can anybody see what I’m doing wrong?

<?php 

    $array = array(
          '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 
          'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 
          'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 
          'u', 'v', 'w', 'x', 'y', 'z', '!', '£', '$', '%',
          '^', '&', '*', '(', ')', '_', '+', '{', '}'
    );

    $length_of_unique_key = 15;
    $counter = 0;

    foreach($array as $values)
    {
          $counter++;

          while ($counter <= $length_of_unique_key)
          {

          }
    }

?>
  • 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-11T16:09:23+00:00Added an answer on May 11, 2026 at 4:09 pm

    Shouldn’t you be incrementing your counter within the while loop, so it can exit?

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

Sidebar

Related Questions

We have the following method where we are trying to access an array object
Trying to use JSTL but have the following problem: Index.xhtml page: <?xml version=1.0 encoding=UTF-8?>
Ok so I have an array that holds the following elements: $array['a']['b'][0]['c']; $array['a']['b'][1]['c']; $array['a']['d'][0]['c']['c'];
I'm trying to return an array of counted values for consecutive date ranges (that
I have an array that contains dates and values. An example of how it
gcc (GCC) 4.7.0 c89 Hello, I have the following structure that I am trying
I have the following section of code that acts on values in <Test></Test> nodes
I have the following powershell script that I am trying to adapt for use
I have the following two arrays , i am trying to see whether if
The following image have been uploaded to show what I am trying to do

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.