Senior PHP Programmer

  Home  Computer Programming  Senior PHP Programmer


“Sr. PHP Programmer based Frequently Asked Questions by expert members with experience as Senior PHP Programmer. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts”



202 Senior PHP Programmer Questions And Answers

148⟩ How eregi() function works?

eregi() − The eregi() function searches throughout a string specified by pattern for a string specified by string. The search is not case sensitive.

 199 views

149⟩ Explain how a PHP session works?

A PHP session cookie is set in the clients browser, on every request the client sends that cookie to the server. PHP then uses that cookie to select the corresponding session information. By default PHP session_start() will store session data in files, you can also store sessions in a database.

 217 views

150⟩ What is the purpose of $_SERVER variable in PHP?

$_SERVER − This is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER variables.

 218 views

153⟩ What is Polymorphism in PHP context?

Don't get scared by the big word. It's simply the idea that one object can can take on many forms. So in PHP OOP one class "cars" may have two classes that extend it, for example a "Honda" class and a "BMW" class.

 189 views

155⟩ What is the Scope Resolution Operator?

"::" double colons is the scope operator it is used to call methods of a class that has not been instantiated. You should also understand static methods and how they differ from regular methods.

 189 views

157⟩ What are the different types of PHP variables?

PHP has a total of eight data types which we use to construct our variables −

☛ Integers − are whole numbers, without a decimal point, like 4195.

☛ Doubles − are floating-point numbers, like 3.14159 or 49.1.

☛ Booleans − have only two possible values either true or false.

☛ NULL − is a special type that only has one value: NULL.

☛ Strings − are sequences of characters, like 'PHP supports string operations.'

☛ Arrays − are named and indexed collections of other values.

☛ Objects − are instances of programmer-defined classes, which can package up both other kinds of values and functions that are specific to the class.

☛ Resources − are special variables that hold references to resources external to PHP (such as database connections).

 196 views

158⟩ What are the 3 scope levels available in PHP and how would you define them?

☛ Private - Visible only in its own class

☛ Public - Visible to any other code accessing the class

☛ Protected - Visible only to classes parent(s) and classes that extend the current class

This is important for any developer to know because it shows an understanding that building applications is more than just being able to write code. One must also have an understanding about privileges and accessibility of that code. There are times protected variables or methods are extremely important, and an understanding of scope is needed to protect the integrity of the data in your application along with provide a clear path through the code.

 195 views

160⟩ How ereg() function works?

ereg() − The ereg() function searches a string specified by string for a string specified by pattern, returning true if the pattern is found, and false otherwise.

 218 views