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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:28:09+00:00 2026-06-13T15:28:09+00:00

Hey all i am new at classes and arrays in php but need to

  • 0

Hey all i am new at classes and arrays in php but need to find out how to go about getting the correct value from this class function array

class theCart {
    public static $DISTANCE = array(
      '0'  => '0 - 75',
      '10' => '76 - 125',
      '20' => '126 - 175',
      '30' => '176 - 225',
      '40' => '226 - 275',
      '50' => '276 - 325'
    );
}

My output i am trying to match looks like this: 76 – 125

Do i just call it like

 $distanceNum = '76 - 125';
 $tmpDistanceTotal = $DISTANCE($distanceNum);

Should $tmpDistanceTotal then have a value of 10? I’m thinking that the array only has the values 0,10,20,30,40,50 in it?

I have another array:

public static $STEPS = array(
    '0' => 0,
    '1' => 0,
    '2' => 0,
    '3' => 25,
    '4' => 50,
    '5' => 75,
    '6' => 100,
    '7' => 125
);

My output i am trying to match with that above is 3 I’m not sure if its looking for a string or not?

  • 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-13T15:28:10+00:00Added an answer on June 13, 2026 at 3:28 pm

    This should clear the point:

    foreach (theCart::$DISTANCE as $k => $v) {
        if ($v == '76 - 125') {
            echo $k;
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all i am trying to find examples of getting data back from a
Hey all i am in need of some help getting my code working correctly
Hey all need a lil help sorting a loop for this table out, cant
Hey all i am trying to figure out how to go about inserting a
Hey all i am getting an odd returned value in VB.net when i try
Hey all, i am new at everything VB.net/ASP.net so i need some help with
Hey all I'm extremely new to jquery and ajax and I'm looking for some
Hey all, I want to change a value in a table (in a mysql
Hey all. I'm reading from one sql-format file to another, and two bytes in
Hey all i am new to XML parsing on VB.net. This is the code

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.