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

The Archive Base Latest Questions

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

I was going through Questions every good .Net developer should be able to answer

  • 0

I was going through Questions every good .Net developer should be able to answer and was highly impressed with the content and approach of this question and so in the same spirit, I am asking this question for PHP Developer.

What questions do you think should a good PHP programmer be able to respond to?

EDIT : I am marking this question as community wiki as it is not user specific and it aims to serve programming community at large.

Looking forward for some amazing responses.

NOTE : Please answer questions too as suggested in the comments so that people could learn something new too regarding the language.

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

    Admittedly, I stole this question from somewhere else (can’t remember where I read it any more) but thought it was funny:

    Q: What is T_PAAMAYIM_NEKUDOTAYIM?
    A: Its the scope resolution operator (double colon)

    An experienced PHP’er immediately knows what it means.
    Less experienced (and not Hebrew) developers may want to read this.

    But more serious questions now:


    Q: What is the cause of this warning: ‘Warning: Cannot modify header information – headers already sent’, and what is a good practice to prevent it?
    A: Cause: body data was sent, causing headers to be sent too.
    Prevention: Be sure to execute header specific code first before you output any body data. Be sure you haven’t accidentally sent out whitespace or any other characters.


    Q: What is wrong with this query: "SELECT * FROM table WHERE id = $_POST[ 'id' ]"?
    A: 1. It is vulnarable to SQL injection. Never use user input directly in queries. Sanitize it first. Preferebly use prepared statements (PDO) 2. Don’t select all columns (*), but specify every single column. This is predominantly ment to prevent queries hogging up memory when for instance a BLOB column is added at some point in the future.


    Q: What is wrong with this if statement: if( !strpos( $haystack, $needle ) ...?
    A: strpos returns the index position of where it first found the $needle, which could be 0. Since 0 also resolves to false the solution is to use strict comparison: if( false !== strpos( $haystack, $needle )...


    Q: What is the preferred way to write this if statement, and why?
    if( 5 == $someVar ) or if( $someVar == 5 )
    A: The former, as it prevents accidental assignment of 5 to $someVar when you forget to use 2 equalsigns ($someVar = 5), and will cause an error, the latter won’t.


    Q: Given this code:

    function doSomething( &$arg )
    {
        $return = $arg;
        $arg += 1;
        return $return;
    }
    
    $a = 3;
    $b = doSomething( $a );
    

    …what is the value of $a and $b after the function call and why?
    A: $a is 4 and $b is 3. The former because $arg is passed by reference, the latter because the return value of the function is a copy of (not a reference to) the initial value of the argument.


    OOP specific

    Q: What is the difference between public, protected and private in a class definition?
    A: public makes a class member available to “everyone”, protected makes the class member available to only itself and derived classes, private makes the class member only available to the class itself.


    Q: What is wrong with this code:

    class SomeClass
    {
        protected $_someMember;
    
        public function __construct()
        {
            $this->_someMember = 1;
        }
    
        public static function getSomethingStatic()
        {
            return $this->_someMember * 5; // here's the catch
        }
    }
    

    A: Static methods don’t have access to $this, because static methods can be executed without instantiating a class.


    Q: What is the difference between an interface and an abstract class?
    A: An interface defines a contract between an implementing class is and an object that calls the interface. An abstract class pre-defines certain behaviour for classes that will extend it. To a certain degree this can also be considered a contract, since it garantuees certain methods to exist.


    Q: What is wrong with classes that predominantly define getters and setters, that map straight to it’s internal members, without actually having methods that execute behaviour?
    A: This might be a code smell since the object acts as an ennobled array, without much other use.


    Q: Why is PHP’s implementation of the use of interfaces sub-optimal?
    A: PHP doesn’t allow you to define the expected return type of the method’s, which essentially renders interfaces pretty useless. 😛

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

Sidebar

Ask A Question

Stats

  • Questions 380k
  • Answers 380k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As stated by @Raise, the simple solution to this is… May 14, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer memset is practically never the right way to do it.… May 14, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Using a notification is a pretty good solution. Another, which… May 14, 2026 at 9:50 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.