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

  • Home
  • SEARCH
  • 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 6543983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:24:42+00:00 2026-05-25T11:24:42+00:00

For example this is my class: <?php Class Example { public function example_function() {

  • 0

For example this is my class:

<?php 
 Class Example
 {
  public function example_function()
  {
   echo "example code";
  }
 }
?>

Which one of the following will be best, performance-wise?

1)

Example::example_function();

2)

$example = new Example();
$example->example_function();

What is the difference between them?

  • 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-25T11:24:42+00:00Added an answer on May 25, 2026 at 11:24 am

    It not a matter of performance. It really isn’t. The difference, if there is one, is so minuscule as to be hardly measurable.

    If you need to design your class with static methods, use static methods.
    If you need to instantiate your class, you have no choice but to use object methods.

    It’s a class design decision that has nothing to do with performance.

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

Sidebar

Related Questions

take a look at this example code: public class Comment { private Comment() {
I have piece of code: class example { public function say($x) { if ($x
Bit long title, comes down to this: <?php class error { public function error($errormsg
According to the PHP manual , a class like this: abstract class Example {}
Please consider this example class: [Serializable] public class SomeClass { private DateTime _SomeDateTime; public
What does it mean to call a class like this: class Example { public:
Take this class as example: public class Category : PersistentObject<int> { public virtual string
Take this sample class as an example: [AttributeUsage(AttributeTargets.All, AllowMultiple=true)] public class BugFixAttribute : System.Attribute
For example I now created a this tiny class: public static class FileSystemInfoComparers<T> where
Consider this example: #include <iostream> class myclass { public: void print() { std::cout <<

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.