Category Archives: Interview Question

Php Interview Questions and Answers – Part 2

job-interview-question




1- Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.nHow are you?nThanks for visiting techpreparation’; print $str; ?> Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and n. 2- Would you initialize your strings with single quotes or double quotes? Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a […]

Mysql interview questions

mysql-question




Q 1- How to setup admin user for MYSQL ? Ans: Login as super user ‘root’ in mysql and execute the following commands. mysql> use mysql; mysql> create user ‘test’@’%’ identified by ‘test’; mysql> grant all on *.* to ‘test’@’%’ with grant option; mysql> flush privileges; Q 2- What types of privileges are there in MySQL ? Ans: There are 4 types of privileges. i). Global privileges like *.* (all hosts connecting to Mysql db server) Example: GRANT SELECT, INSERT […]

Php Interview Questions and Answers – Part 1

php-question




1- What’s PHP ? The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. 2- What Is a Session? A session is a logical object created by the PHP engine to allow you to preserve data across subsequent HTTP requests. There is only one session object available to your PHP scripts at any time. Data saved to the session by […]