+2

PHP Interview Questions

PHP is a recursive acronym for PHP Hypertext Preprocessor. It is a widely used open-source programming language especially suited for creating dynamic websites and mobile API's

Below we have listed few Frequently Asked PHP Interview Questions

1. What is PHP ?

PHP: Hypertext Preprocessor is open source server-side scripting language that is widely used for creation of dynamic web applications. It was developed by Rasmus Lerdorf also know as Father of PHP in 1994. PHP is a loosely typed language , we didn’t have to tell PHP which kind of Datatype a Variable is. PHP automatically converts the variable to the correct datatype , depending on its value.

2. Where sessions stored in PHP ?

PHP sessions are stored on server generally in text files in a temp directory of server. That file is not accessible from outside word. When we create a session PHP create a unique session id that is shared by client by creating cookie on clients browser.That session id is sent by client browser to server each time when a request is made and session is identified. The default session name is “PHPSESSID”.

3. What are PHP Magic Methods/Functions. List them.

In PHP all functions starting with __ names are magical functions/methods. Magical methods always lives in a PHP class.The definition of magical function are defined by programmer itself.

Here are list of magic functions available in PHP

__construct(), __destruct(), __call(), __callStatic(), __get(), __set(), __isset(), __unset(), __sleep(), __wakeup(), __toString(), __invoke(), __set_state(), __clone() and __debugInfo() .

Also Read : Best Core PHP Interview Questions

4. List data types in PHP ?

PHP supports 9 primitive types

4 scalar types:

  • integer

  • boolean

  • float

  • string 3 compound types:

  • array

  • object

  • callable And 2 special types:

  • resource

  • NULL

5. What are the encryption functions available in PHP ?

crypt(), Mcrypt(), hash() are used for encryption in PHP

Being PHP a open source programming Language and serving the web more than 30 years, below points let you know why PHP shines

  • Open Source
  • Cross-Platform Compatibility
  • Loosely Typed Programming Language
  • PHP Traits
  • Magic Method
  • Supports nowdocs and heredocs String
  • Easy to Learn
  • Plenty of jobs
  • Real-Time Tracking and Error Reporting

All rights reserved

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí