Priti's Technical Corner

June 24, 2009

PHP Quiz


Test yourself !!

Question 1:
$a = 4;
for ($b = 0; $b <= $a; $b++) {
$c++;
}
Answer : 5

Question 2:
$a = “abc”;
$b = substr($a, 0, -1);
Answer : ab

Question 3:
$a = “0”;
$b = “0”;
if ($a != “1” && $b == “1” || $a != “0” || $b != “1” ){
$d = “0”;
}else{
$d = “1”;
}
Answer : 0

Question 4:
$a = “who_are_you”;
$b = array(“who_”, “_”);
$c = array(“”, ” “);
$d = ucwords(str_replace($b,$c,$a));

Answer :Are You

Question 5:
$c = “<tt>some</tt><b>hi</b>”;
preg_match(“/<\w?>(\w*?)<\/\w?>/”,$c,$p);
echo $p;
Answer : hi

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: