PHP
PHP Interview Questions
1. How PHP is executed in server?
1.cgi = adv/disadvantage, 2.so or dll object => adv/disadvantage
2. Why the interface involve?
3. Where to use interface and abstract class?
4. What are design patterns , give 2 example?
5. Different b/w dedicated server and cloud computing?
6. How many ways you will validate soap request?
7. How to do to array and object iteration ?
8. How to use caching for static data like user information and frequent used image?
9. How to set expiration date and time for tpl file?
10. is it possible to extend smarty class? Yes
Brainbench php 5.3 Question Answers
<?php
class Vehicle {
protected static $mCarColor = 'White';
protected static $mCarDoors = 4;
public static function getCarColor() {
return self::$mCarColor;
}
public static function getCarDoors() {
return self::$mCarDoors;
}
}
class Cabriolet extends Vehicle {
protected static $mCarColor = 'Red';
protected static $mCarDoors = 3;
public static function getCarDoors() {
return self::$mCarDoors;
}
}?>
Web Service using SOAP
Simple Object Access Protocol(SOAP) provides communicate between applications is over HTTP protocol. The communication of request and response by the xml data.
prerequisite PHP Extension are
XML ,SOAP, XSL
Web services approach has 2 component
1. Service Provider (Service provider)
2. Service requester (Service Consumer)
web spider, crawler, indexing and search engine Scripts
The heart of web Spider is just 2 process.
1.Parsing HTTP Text (HTML).
2.How you Traverse the Link.
Parsing HTTP Text:
Generally CURL Library is used grab the content of HTML. From The HttpText we have grab the URL as follows
1. Links(like anchor tag)
2. Form action attribute
3.Meta Tag .
Store the Link from database.
Traverse Link:
Writing Business Critical Applications in PHP
Hi,
Generally Business critical applications that need performance will use a byte-code cache such as Zend Platform, APC(Alternative PHP Cache), eAccelerator, etc…
In the above APC is light weight cache engine which is written by Yahoo & using it.
PHP 5.3 suppots 64 bit numbers
The PHP 5.3 supports processing 64 bit data for the integer values only, but the floating point numbers remains constant as follows
Double => The value stored as per IEEE 754 standard
32 bit Platform
Integer => can hold 32 bit values => 2 ^31 to 2^31-1 => 2147483648 to 2147483647
Float => can hold 64 bit values => Mantissa(m):0-51,Exponent (e):52-62,Sign:1, =>4.9 x 10-307 .. 1.8 x 10+308
64 bit Platform
Integer => can hold 64 bit values =>2 ^63 to 2^63-1 => 9223372036854775808 to 9223372036854775807
Read XML Child Node (Xpath)Values of Specific Parent Tag
I need the Node values of child tag(person name) from specific parent tag (Person) only not any of other other child Node value.
for Ex:
I need the Node values of all Person Name only,
since name tag is same for both person name and its sub child name (company name) also, i am getting both person name & company name.
I am using Dom getElementsByTagName function.Please any of one help me how to grab the values of specific Tag level only. The code as follows.
<?php
$vXML="
<info>
<person>
<name>person 1 </name>
<email>email1@yahoo.com</email>
<company>
<name>company 1 </name>?>
Packing and Unpacking for 64 bit Data in PHP 5.3
In arise of PHP 5.3 supports of 64 bit data processing , But small things was missed like
Packing and Unpacking for 64 bit. in Perl , Q argument used for processing 64 bit data.
<?php
$vBinData = pack("Q", 0x123456781234568);
$vHexData = bin2hex($vBinData);
var_dump($vHexData);
list(,$v32Value) = unpack('Q', chr(0x80).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x00).chr(0x09));
print $v32Value;
echo hexdec(dechex($v32Value)) . "0x" . dechex($v32Value) ;
?>
PHP6 with unicode
There are 2 steps for Configure PHP 6
1. you have Configure and Installing ICU (International Components for Unicode)
2. After step1 only you can Configure PHP 6
Steps for Configure and Installing ICU (International Components for Unicode)
wget ftp://ftp.software.ibm.com/software/glo ... _6-src.tgz
mkdir /usr/local/lib/icu-3_6
tar -xvf icu*
cd icu/source
./configure --prefix=/usr/local/lib/icu-3_6
make && make install
Configure PHP 6
if u already installed by rpm, .debian package then give that corresponding ICU path. now assume /usr/local/lib/icu-3_6 as follows