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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:31:55+00:00 2026-06-13T05:31:55+00:00

I have this odd situation and I can’t think of a solution for it.

  • 0

I have this odd situation and I can’t think of a solution for it.

I have a variable $cat_count = 1; and I use it inside a loop and then do $cat_count++ somewhere below where I’ve used it.

Then I have another alphabetical counter which works the following way:

I have $alpha_string = 'abcdefghijklmnopqrstuvwxyz'; and $alpha_counter = 0;. I use this the following way – $alpha = $alpha_string{$alpha_counter}. I want my alphabetical counter to start counting from a, whenever $cat_count gets incremented by one.

So for example we would have this:

$cat_count = 1
$alpha = a
$alpha = b

$cat_count = 2
$alpha = a
$alpha = b

What I get momentarily is this:

$cat_count = 1
$alpha = a
$alpha = b

$cat_count = 2
$alpha = c
$alpha = d

Ideas?

Thank you.

  • 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-13T05:31:58+00:00Added an answer on June 13, 2026 at 5:31 am

    following my answer in comments..

    $counter        = 0;
    $cat_count      = 1;
    $alpha_count    = 'abcdefghijklmnopqrstuvwxyz';
    $rule_id        = null;
    $public_cats    = array();
    
    while ($row = $db->sql_fetchrow($result))
    {
        if ($rule_id != $row['rule_id']) 
        {       
            $group_ids  = array_map('intval', explode(' ', $row['groups']));
            $is_grouped = false;
    
            // Check if user can see a specific category if he is not an admin or moderator
            if (!$auth->acl_get('a_') && !$auth->acl_get('m_'))
            {
                $is_grouped = (group_memberships($group_ids, $user->data['user_id'], true)) ? true : false;
            }
            else
            {
                $is_grouped = true; 
            }
    
            // Fill $public_cats with boolean values
            if ($is_grouped !== false)
            {
                $public_cats[] = $is_grouped;
            }
    
            $rule_id = $row['rule_id'];
    
            $template->assign_block_vars('rules', array(
                'RULE_CATEGORY' => $row['rule_title'],
                'ROW_COUNT'     => $cat_count,
                'CAN_SEE_CAT'   => $is_grouped
            ));
    
            $cat_count++;
            $counter = 0;
        }
    
        $uid = $bitfield = $options = '';
        generate_text_for_storage($row['rule_desc'], $uid, $bitfield, $options, $row['bbcode'], $row['links'], $row['smilies']);
    
        $template->assign_block_vars('rules.rule', array(
            'RULE_DESC'     => generate_text_for_display($row['rule_desc'], $uid, $bitfield, $options),
            'ALPHA_COUNT'   => $alpha_count{$counter}
        ));
    
        $counter++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this hypothetical, odd and unintuitive situation #include <iostream> struct A {
This is a bit of an odd situation. Here's what's happening. So, we have
I have odd problem: After starting server I got this error: undefined local variable
This is a really odd situation that I can't seem to work out where
This is a pretty odd situation I have here. I have used a piece
I can't find this piece of information. I'm dealing with an odd situation here
I have a bit a of an odd situation happening and I can't seem
That sounds pretty odd but i have this cod and i need to convert
I have been banging my head against the wall with this odd behaviour on
This is odd. I have a Default.png, Default-Landscape.png, Default-Portrait.png and Default@2x.png. The normal default

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.