Sharag Web

Get All Information

PHP ARCHITECT QUESTIONS AND ANSWERS

What’s the difference between  <SPAN> and  <div> tags?
Span is for inline elements. Div is for block elements.
<div>tags are block elements that allow you to position elements contained within block.
tags used for inline styling of text.
<div> tags create line breaks, <span> tags doesn’t.
div elements are placed in a row, in other words automatic break is inserted. Whereas in case of span elements all are coming one after the other without any breaks.
Note: Can change inline element into block level element through CSS and vise-versa.
div{display:inline}
span{display:block}
Explain Data encryption in PHP ?
The PHP crypt() function can be used to encrypt data.
MD5 is a one way HASH
base64_encode is for encoding data.
Echo, print, printf – what is the difference between these?
Print and echo both output what is passed to them. Print acts like a function, so you can use it in complex statements. Printf is used to format the output
how variables are passed to functions by reference and by value?
A variable is passed by value unless the variable is passed with an &, such as functionName(&$variableName)
How can I execute a PHP script using command line?
PHP script using command line can be executed using SAPI
(Server Application programming Interface). Using SAPI
Command Line Interface the PHP code can be passed to execute
directly
Example:
Php –r ‘print_r(get_defined_constanrs());’
php filename
From a shell/cmd prompt, php –v will display whether the SAPI is CLI or CGI
explain YAHOO’s 20 points for web performance optimization ?
1. Flush the buffer early [server]
2. Use GET for AJAX requests [server]
3. Post-load components [content]
4. Preload components [content]
5. Reduce the number of DOM elements [content]
6. Split components across domains [content]
7. Minimize the number of iframes [content]
8. No 404s [content]
9. Reduce cookie size [cookie]
10. Use cookie-free domains for components [cookie]
11. Minimize DOM access [javascript]
12. Develop smart event handlers [javascript]
13. Choose <link> over @import [css]
14. Avoid filters [css]
15. Optimize images [images]
16. Optimize CSS sprites [images]
17. Don’t scale images in HTML [images]
18. Make favicon.ico small and cacheable [images]
19. Keep components under 25K [mobile]
20. Pack components into a multipart document [mobile]
FMI : http://developer.yahoo.com/performance/rules.html
What are all the new changes in PHP6 ?
Here is the list :

  1. FILE_BINARY and FILE_TEXT constants available for use with filesystem functions.
  2. register_globals will be gone.
  3. magic_quotes will also disappear.
  4. $HTTP_*_VARS has been removed, in favour for $_GET, $_POST, etc.
  5. ereg() no longer available in core PHP6.
  6. Initiating objects with the reference operator (& new Object()) will generate E_STRICT error.
  7. E_STRICT error messages are included in E_ALL errors.
  8. {} for string offsets no longer available.
  9. [] un-deprecated for accessing characters in a string.
  10. ASP-style tags can no longer be used.
  11. Better Unicode Support.
  12. var will be an alias of public, and raises E_STRICT warning.
  13. Support for 64 bit integers.
  14. With ternary operator, the “true” expression is no longer required – this can be done: $a = $s ?: ‘b’; (Not clear yet exactly how this will work).
  15. zend.ze1_compatibility_mode removed.
  16. safe_mode is being removed.
  17. Freetype1 and GD1 support removed.
  18. dl() is only enabled when a SAPI layers registers it explicitly.
  19. Support for dynamic break levels removed.
  20. XMLReader and XMLWriter will be in the core distribution.
  21. mime_magic removed from the core.
  22. Fileinfo moved to the core.
  23. ext/soap on by default.
  24. foreach supports multi-dimensional arrays: foreach($a as $b => list($c, $d))
  25. microtime() will return as float by default.
  26. opcode cache included in core distribution, but turned off by default.
  27. flags parameter available for file_get_contents().
  28. before_needle parameter added to strstr() – allows strstr() to return part of haystack before occurence of the needle.
  29. namespace, import, and goto become reserved words.

FMI : http://blog.tuvinh.com/one-minute-with-php6/

Leave a Reply

Your email address will not be published. Required fields are marked *

You cannot copy content of this page