ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Scripts  >>  PHP
 
 


 

 
 PHP interview questions  PHP Interview Questions
 ASP interview questions  ASP Interview Questions
 CGI Perl interview questions  CGI Perl Interview Questions
 JavaScript interview questions  JavaScript Interview Questions
 VB Script interview questions  VB Script Interview Questions
 JSP interview questions  JSP Interview Questions
 Shell Script interview questions  Shell Script Interview Questions
 Python interview questions  Python Interview Questions
 Tcl interview questions  Tcl Interview Questions
 Awk interview questions  Awk Interview Questions
 AJAX interview questions  AJAX Interview Questions
 Ruby on Rails interview questions  Ruby on Rails Interview Questions
 Scripts AllOther interview questions  Scripts AllOther Interview Questions
Question
Extract url from this string? It should be flexible for all 
strings, not for this string only.
"yahoo.comyahoo.co.inhotmail.org"
 Question Submitted By :: Abhishek Anand
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Extract url from this string? It should be flexible for all strings, not for this string only. "yahoo.comyahoo.co.inhotmail.org"
Answer
# 1
##
##This will work for PHP 5.3 -

$url1="yahoo.com";
$url2="yahoo.co.in";
$url3="hotmail.org";

$domain1 = strstr($url1, '.', true);
$domain2 = strstr($url2, '.', true);
$domain3 = strstr($url3, '.', true);

echo $domain1, $domain2, $domain3;


##
## For Older PHP (<5.2.8), this code will follow -
$url1="yahoo.com";
$url2="yahoo.co.in";
$url3="hotmail.org";

$domain1 = substr($url1, 0, strpos($url1, '.') );
$domain2 = substr($url2, 0, strpos($url2, '.') );
$domain3 = substr($url3, 0, strpos($url3, '.') );

echo $domain1, $domain2, $domain3;


 
Is This Answer Correct ?    1 Yes 2 No
Amitverma
 

 
 
 
Other PHP Interview Questions
 
  Question Asked @ Answers
 
PHP serverside scripting language or client side scripting language>  8
write the function to fetch a image from mysql databases (datatype blob).  1
what is hidden variable? what is its difference with the normal variable... Shine2
Is it possible to get the screen resolution and like with php?  1
How do you register one session ?  3
How can I maintain the count of how many persons have hit my site? Rushmore-Consultancy1
What are the different tables present in mysql, which type of table is generated when we are creating a table in the following syntax: create table employee(eno int(2),ename varchar(10)) ?  3
Does winrunner 8.0 or qtp 8.0 supports php  2
Would you initialize your strings with single quotes or double quotes?  3
How can i send a HTML file to mail account.  2
What is the advantge and disadvantage of mysql_connet() and mysql_pconnect() ? in which condition will you use mysql_connect() and mysql_pconnect(). Avanigoradia2
what method is used to get a user's IP address?  2
How to Define a Constant in PHP? Is $ symbol necessary? Maples5
Hi all, I have a problem in Apache on windows xp.I tried to unistall apache and install it again. But when in did the installation again, and tried to run apache, i get the following error message, Socketaddresse can just be used once. Make_sock: could not build to address 0.0.0.0.80 No listening sockets available.Shutting down Unable to open logs. and i also get (error) OS2. The system cannot fine the installed service named "Apache2". Please i need some one to help me out with this.I'm really fustrated cuz i need this stuff working as fast as possible. PLEASE HELP ME  2
What is meant by content management system? Global-Logic3
Write a regular expression to get the value xxx from the string 'xxx@yyy.com'  2
What are the different ways we can retrive the mysql results using php ? Explain each  1
what is Abbreviavion of PHP?  2
how we can use lamp.ie installatiion and basic workings.Is it similar to wamp in usage?  1
What is the substitution of submit in PHP? RedAlkemi6
 
For more PHP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com