WordPress Interview Questions & Answers – Part5
41. What is the difference between accessing a class method via -> and via ::?
:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.
42. Why wordpress is better than blogger for blogging?
1. Customization and Flexibility
2. Hosting Opportunities
3. To customize the tiny image that people see in their address bar when they visit your blog, upload a blavatar.
4. The more tag allows you to display excerpts of your posts on your main posts page, instead of revealing the entire post.
5. To expand the text editor and hide the modules on the publishing screen, enable Distraction Free Writing.
6. Reproduce fully-functioning tweets — not just static screenshots of tweets — in posts, pages, and even comments with Twitter Embeds.
7. You can customize your post and page slugs, which can be handy when you want to create a URL that’s easier to remember (it’s also a good way to make posts search-friendly). Note that if you change a post slug, the old link will still work.
8. Reproduce fully-functioning tweets — not just static screenshots of tweets — in posts, pages, and even comments with Twitter Embeds.
43. Suppose If the variable $a is equal to 5 and variable $b is equal to character a, whats the value of $$b?
100, it’s a reference to existing variable.
44. How to find out the number of parameters passed into function?
func_num_args() function returns the number of parameters passed in.
45. What is the ternary conditional operator in PHP?
Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.
46. Explain When are you supposed to use endif to end the conditional statement?
When the original if was followed by : and then the code block without braces.
47. Explain Will comparison of string 10″ and integer 11 work in PHP?
Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
48. Can you tell me when you will use endif function to end the condition statement?
The endif function is used to end the conditional statement when the parent if is followed by : and the code is blocked without the use of any braces.
49. Suppose I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, whats the problem?
PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.
50. What is the difference between starting a string with single quote and double quote? What you will use in general instance?
A data kept inside a single quoted string is not parsed for variable substitution where as when we initialize the string with double quote the data is parsed for variable substitution. If we don’t require variable substitution particularly then it is always preferred to use single quote as it is much speedy process.