(Frequently Asked Questions)

Similar documents
Programming for the Web with PHP

Alpha College of Engineering and Technology. Question Bank

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

exam. Number: Passing Score: 800 Time Limit: 120 min File Version: Zend Certified Engineer

zend. Number: Passing Score: 800 Time Limit: 120 min.

PHP CURRICULUM 6 WEEKS

Hands-On Perl Scripting and CGI Programming

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts

An Introduction to JavaScript & Bootstrap Basic concept used in responsive website development Form Validation Creating templates

PHP INTERVIEW QUESTION-ANSWERS

PHP 5 Introduction. What You Should Already Know. What is PHP? What is a PHP File? What Can PHP Do? Why PHP?

PHP & My SQL Duration-4-6 Months

DATABASE SYSTEMS. Introduction to web programming. Database Systems Course, 2016

PHP & PHP++ Curriculum

PHP. MIT 6.470, IAP 2010 Yafim Landa

Application Development in JAVA. Data Types, Variable, Comments & Operators. Part I: Core Java (J2SE) Getting Started

Top Ten Tips for Getting Started with PHP

CERTIFICATE IN WEB PROGRAMMING

What is PHP? [1] Figure 1 [1]

Introduction to PHP. Handling Html Form With Php. Decisions and loop. Function. String. Array

Developing Web Applications

Lecture 7: Dates/Times & Sessions. CS 383 Web Development II Wednesday, February 14, 2018

PHP + ANGULAR4 CURRICULUM 6 WEEKS

Lucid Key Server. Help Documentation.

PHP 1. Introduction Temasek Polytechnic

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

Managing State. Chapter 13

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Java Applets, etc. Instructor: Dmitri A. Gusev. Fall Lecture 25, December 5, CS 502: Computers and Communications Technology

CNIT 129S: Securing Web Applications. Ch 10: Attacking Back-End Components

INTRODUCTION TO.NET. Domain of.net D.N.A. Architecture One Tier Two Tier Three Tier N-Tier THE COMMON LANGUAGE RUNTIME (C.L.R.)

Professional Course in Web Designing & Development 5-6 Months

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

FINALTERM EXAMINATION Spring 2009 CS506- Web Design and Development Solved by Tahseen Anwar

Introduction. Server-side Techniques. Introduction. 2 modes in the PHP processor:

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Lecture 6: More Arrays & HTML Forms. CS 383 Web Development II Monday, February 12, 2018

CS506 Web Design & Development Final Term Solved MCQs with Reference

Sections and Articles

Database Concepts. Online Appendix I Getting Started with Web Servers, PHP, and the NetBeans IDE. 7th Edition. David M. Kroenke David J.

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Get in Touch Module 1 - Core PHP XHTML

Chapter 7:- PHP. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Inf 202 Introduction to Data and Databases (Spring 2010)

Security issues. Unit 27 Web Server Scripting Extended Diploma in ICT 2016 Lecture: Phil Smith

DOT NET Syllabus (6 Months)

Project Title REPRESENTATION OF ELECTRICAL NETWORK USING GOOGLE MAP API. Submitted by: Submitted to: SEMANTA RAJ NEUPANE, Research Assistant,

The PHP language. Teaching you everything about PHP? Not exactly Goal: teach you how to interact with a database via web

Welcome! PHP Barcelona - Barcelona, Spain - Oct 28th, 2011 Derick Rethans - -

Shankersinh Vaghela Bapu Institue of Technology

How to force automatic removal of deleted files in nextcloud

BY: ATASHI SAMADDAR 1

Web Programming Paper Solution (Chapter wise)

Zend PHP 5 Certification

Zend Zend Certified PHP Developer. Download Full Version :

CONTENTS IN DETAIL INTRODUCTION 1 THE FAQS OF LIFE THE SCRIPTS EVERY PHP PROGRAMMER WANTS (OR NEEDS) TO KNOW 1 2 CONFIGURING PHP 19

PHP. Interactive Web Systems

Web System and Technologies (Objective + Subjective)

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017

All Applications Release Bulletin January 2010

Homework 4: Comparing Search Engine Ranking Algorithms

Web development using PHP & MySQL with HTML5, CSS, JavaScript

Lecture 12. PHP. cp476 PHP

GET /index.php HTTP/1.1 Host: User- agent: Mozilla/4.0

Lecture 3: Web Servers / PHP and Apache. CS 383 Web Development II Monday, January 29, 2018

Creating HTML files using Notepad

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

"Charting the Course... Intermediate PHP & MySQL Course Summary

Part I. Web Technologies for Interactive Multimedia

SNS COLLEGE OF ENGINEERING, Coimbatore

Static Webpage Development

Exam Actual. Higher Quality. Better Service! QUESTION & ANSWER

Exam Questions

How browsers talk to servers. What does this do?

PHP Hypertext Preprocessor

PHP: Software Training Employability Programme

Traditional Web Based Systems

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

Some things to watch out for when using PHP and Javascript when building websites

Migration Tool. User Guide. SHOPIFY to MAGENTO. Copyright 2014 LitExtension.com. All Rights Reserved.

Smashing Node.JS: JavaScript Everywhere

Web Development Course (PHP-MYSQL-HTML5.0)

HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests

Database Systems Fundamentals

Web Development & SEO (Summer Training Program) 4 Weeks/30 Days

MAGENTO Migration Tools

Connecting with Computer Science Chapter 5 Review: Chapter Summary:

CENG 256 Internet Programming Draft

Secure coding practices

Saurus CMS Installation Guide

Web Programming with PHP

WEB APPLICATION ENGINEERING II

USQ/CSC2406 Web Publishing

Creating and Managing Snippets

Apache, Php, MySql Configuration

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP

Java.. servlets and. murach's TRAINING & REFERENCE 2ND EDITION. Joel Murach Andrea Steelman. IlB MIKE MURACH & ASSOCIATES, INC.

Re3gistry development & testing - Bug #2895 Problems installing registry

ms-help://ms.technet.2004apr.1033/win2ksrv/tnoffline/prodtechnol/win2ksrv/howto/grpolwt.htm

User Manual. Admin Report Kit for IIS 7 (ARKIIS)

Transcription:

(Frequently Asked Questions) Aptech Ltd. Version 1.0 Page 1 of 9

Table of Contents S# Question 1. How do you create sub domains using PHP? 2. What is the difference between echo and print statements in PHP? 3. How can you extract the string toy.com from a string http://sale@toy.com using regular expressions in PHP? 4. What is the difference between include and require? 5. What are the different types of errors in PHP? 6. What are the differences between developing a Website using Java and using PHP? 7. In your PHP code, if all the " characters are being turned into \" characters and ' are being turned into \', how do you get rid of the unwanted backslashes? 8. Can you use include ("cars.php") two times in a PHP page named shopping.php? 9. Why should developers selecting LAMP (Linux, Apache, MySQL, PHP) instead of a combination of other software programs, servers and operating systems? 10. How can you change the maximum size of a file that can be uploaded using php.ini file? 11. What is the technique to increase the execution time of a PHP script? 12. How can you retrieve the value of current session id? 13. How to connect to a URL in PHP? 14. What will be the data type of the $num variable at the end of the following script? <?php $num = "5"; echo $num;?> 16. Which types of form elements can be excluded from the HTTP request? 17. When processing the form, what is the difference between a hidden form element and a non-hidden one, such as a text box? 18. If you set a cookie with either setcookie() or header(), can you check immediately to see whether the client accepted it? 19. Why must you call session_start() before any output? 20. Which PHP function is used to sort an array by its keys in descending order? 21. How can I configure Apache to listen to a different port? 22. How are echo and print different in PHP? 23. What is PHP shell style comment? 24. For a request to download a PDF file, how can I force the browser to display the save dialog to download and save the PDF file? 25. Can I pass a negative number or 0 as the divisor to the intdiv() function? Aptech Ltd. Version 1.0 Page 2 of 9

26. In what situations should I use the flagship (<=>) operator? 27. What are the differences between the ternary (?) and the new null coalescing operator (??)? 28. Can I load a PHP file with the use operator? For what other purposes can I apply the use operator? 29. How does the yield statement works in a generator function? 30. Can I enable strict type checking globally instead of typing declare(string_type=1); in each file? 31. Do anonymous classes support inheritance? 32. What is the difference between the yield and yield from statements? 33. How can I handle multiple exceptions of different types in a catch block? Aptech Ltd. Version 1.0 Page 3 of 9

How do you create sub domains using PHP? Sub domains can be created in PHP by first creating a sub directory in the /htdocs folder. After this is done, the host file needs to be modified to define the sub domain. If the sub domains are not configured explicitly, all requests will be thrown to the main domain. What is the difference between echo and print statements in PHP? Both echo() and print() are used to output strings. The speed of both statements is almost the same. The difference is that echo() can take multiple expressions whereas print cannot take multiple expressions. Another difference is that print returns true or false based on success or failure, whereas echo does not return true or false. How can you extract the string toy.com from a string http://sale@toy.com using regular expressions in PHP? You can use the following code to achieve this: preg_match("/^http:\/\/.+@(.+)$/", http://sale@toy.com,$found); echo $found[1]; What is the difference between include and require? Require() and include() are similar except for the way in which they handle failures. require() results in a fatal error and does not allow the processing of the page whereas include will allow the script to continue. What are the different types of errors in PHP? Notices, Warnings, and Fatal errors are different types of errors in PHP. What are the differences between developing a Website using Java and using PHP? Java uses a technology called Java Server Pages (JSP) to make pages interactive. JSP is more powerful but not as user-friendly or flexible as PHP. PHP is open source whereas JSP is not. Aptech Ltd. Version 1.0 Page 4 of 9

In your PHP code, if all the "characters are being turned into \" characters and 'are being turned into \', how do you get rid of the unwanted backslashes? The backslashes are auto-generated because the PHP directive magic_quotes_gpc is On by default. To resolve the issue, the magic_quotes_gpc directive should be disabled and the PHP function stripslashes() can be used to strip the backslashes from the string. Can you use include ("cars.php") two times in a PHP page named shopping.php? Yes, it is possible to use include() more than one time in any page, though, this is not recommended. Why should developers selecting LAMP (Linux, Apache, MySQL, PHP) instead of a combination of other software programs, servers and operating systems? The reasons are as follows. All these software are open source resource. Linux is far more secure than Windows. Apache has proven to be a better server as compared to IIS with regards to functionality and security. MySQL is one of the world s most popular open source database. PHP is faster than most other scripting languages. How can you change the maximum size of a file that can be uploaded using php.ini file? You can change maximum size of a file by setting the upload_max_filesize variable in the php.ini file. What is the technique to increase the execution time of a PHP script? To increase the execution time of a PHP script, set the max_execution_time variable in php.ini file to your desired time in seconds. How can you retrieve the value of current session id? You can use session_id() function to return the session id for the current session. Aptech Ltd. Version 1.0 Page 5 of 9

How to connect to a URL in PHP? PHP provides a library called curl which may be present as part of your installation of PHP by default. curl (client URL) allows you to connect to a URL and retrieve information from that page such as, the HTML content of the page, the HTTP headers and their associated data, and so on. What will be the data type of the $num variable at the end of the following script? <?php $num = "5"; echo $num;?> The variable will be of string data type because even when a numeric string is assigned to a variable, it remains a string, and it is not converted until needed because of an operation that requires so. Can you pass data from PHP to JavaScript? Yes, because PHP is capable of generating valid JavaScript. Which types of form elements can be excluded from the HTTP request? The radio and check box elements on a form can be excluded. When unselected, both radio buttons and check boxes are excluded from the HTTP request. When processing the form, what is the difference between a hidden form element and a non-hidden one, such as a text box? There is no difference between the two. If you set a cookie with either setcookie() or header(), can you check immediately to see whether the client accepted it? No, you cannot. You must wait until you receive another HTTP request to determine whether it includes the Cookie header. Why must you call session_start() before any output? It is necessary to call session_start() before displaying any output because session_start() sets some HTTP headers. Aptech Ltd. Version 1.0 Page 6 of 9

Which PHP function is used to sort an array by its keys in descending order? The function krsort sorts an array by its keys in descending order. How can I configure Apache to listen to a different port? By default, Apache listens to port 80. However, sometimes some different application or process might already be using port 80. In such situations, you can configure Apache to listen to a different port. For that open the httpd.conf file of Apache and change the Listen 80 configuration to a different port number, say Listen 8080. You can now access Apache as http://loclhost:8080 What is PHP shell style comment? In addition to single line comment (//) and multi-line comment (/* */), PHP also supports Unix /Perl shell-style comments (#). An example of a shell style comment is, as shown: # This is a shell style comment Both # and // have exactly the same behavior. The usage depends on personal preference or coding guidelines laid down for a project. For a request to download a PDF file, how can I force the browser to display the save dialog to download and save a PDF file? Use the Content-Disposition header, as shown: header('content-disposition: attachment; filename="file.pdf"'); Can I pass a negative number or 0 as the divisor to the intdiv() function? Yes, you can. If you pass a negative number as the divisor, the indiv() function will return the negative integer quotient. However, if you pass 0 as the divisor, the indiv() function will throw a DivisionByZeroError exception. In what situations should I use the flagship (<=>) operator? You can use the flagship (<=>) operator to compare two integers, floats, strings, arrays, and objects. The flagship operator is particularly useful in situations where you need to perform sorting or ordering functions. Although there are other ways to perform sorting and ordering functions, the new flagship operator of PHP 7 makes using such functions simpler. Aptech Ltd. Version 1.0 Page 7 of 9

What are the differences between the ternary (?) and the new null coalescing operator (??)? Both the operators check for the existence of some value, and if it doesn't exist, use a default value. One difference between them is that the ternary (?) operator expects the value, and if not present, displays an E_NOTICE along with the default value. However, the null coalescing operator (??) do not displays any notice. Another difference is that the null coalescing operator (??) allows chaining of values that is not possible with the ternary (?) operator. The following code snippets that chains values using the null coalescing operator (??) will output 5. <?php echo $x?? $y?? 5;?> Can I load a PHP file with the use operator? For what other purposes can I apply the use operator? No. You cannot load a PHP file with the use operator. For that, you will need using the autoload() function or the more preferred spl_autoload_register() function. You can apply the use operator for: Aliasing a class name, interface name, or a namespace name. Aliasing or importing function and constant names. This function is available in PHP 5.6 and later versions. Grouping together classes, functions, and constants being imported from the same namespace. This function is available in PHP 7. How does the yield statement works in a generator function? The yield statement appears similar to the more common return statement. However, unlike a return statement that returns a value and then exits from a function, yield instead provides a value to the code that loops over the generator and pauses execution of the generator function. Aptech Ltd. Version 1.0 Page 8 of 9

Can I enable strict type checking globally instead of typing declare(string_type=1); in each file? No. This functionality is not provided primarily because your application might be using external libraries with weak type checking. So, if you enable strict type checking globally, you won t be able to use those libraries. Your application will be limited to use only those libraries having strict type checking. Do anonymous classes support inheritance? Yes. An anonymous class can extend another anonymous class or another named class. The inheritance behavior of an anonymous class is the same as that of a named class. What is the difference between the yield and yield from statements? Both the yield and yield from statements are used in generator functions. The yield statement is used to return data from a generator function. On the other hand, the yield from statement is used to yield values from another generator through a process called generator delegation. How can I handle multiple exceptions of different types in a catch block? You cannot handle multiple exceptions of different types in a single catch block. In such situation you need to have one catch block for each exception. Alternatively, you can use a single catch block to handle the parent Exception that all other exceptions inherit from. However, this approach will be a more generic exception handling measure. ---End of --- Aptech Ltd. Version 1.0 Page 9 of 9