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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:12:11+00:00 2026-06-09T21:12:11+00:00

In myClass I have declared $_total_results_found = 0 Then in my function I changed

  • 0

In myClass I have declared $_total_results_found = 0

Then in my function I changed the value of $_total_results_found = 10

But, when I try to call this outside myClass the value still shows me 0.

Please can any one help me how to write this code?

class myClass
{
  private $_total_rows_count = 0;
  public function foundResults()
  {
    $count = 10;
    $this->_total_rows_count = $count;
  }
} // end myClass


$myclass = new myClass();
echo $myclass->_total_results_found; // Value is showing 0 instead of 10
  • 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-09T21:12:13+00:00Added an answer on June 9, 2026 at 9:12 pm

    Here you go:

    <?
    class myClass
    {
      public $_total_rows_count = 0;
      public function foundResults()
      {
        $count = 10;
        $this->_total_rows_count = $count;
      }
    } // end myClass
    
    
    $myclass = new myClass();
    $myclass->foundResults();
    echo $myclass->_total_rows_count; //will print 10
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C function in MyClass and can call it from inside that
I have this as a return type in Scala Map[String, Seq[Map[String, Seq[MyClass]]]] I have
I have a class like this: class MyClass{ public: MyClass(int Mode); private: std::map <
I have this class: public MyClass { public void initialize(Collection<String> data) { this.data =
I have a class called MyClass This class inherits IEquatable and implements equals the
if i have an outlet variable which i've declared as a property @interface MyClass:UIViewController
I have declared a property in the header file, for example @interface myClass {
I have a property declared on a class: .h @interface myClass : UIView {
I have declared IBOutlets in the header file but when I open the XIB
I have one list of class type, named storeValues declared as: private List<Myclass> storeValues

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.