preg_match in PHP?

 how can we extract string  "pcds.co.in"   from a string  "http://info@pcds.co.in"  using regular expression in php? <?php # "pcds.co.in" # "http://info@pcds.co.in" $content = 'http://info@pcds.co.in'; $pattern = '/http://([a-z]*)@([^/]+)/'; preg_match($pattern, $content, $matches); echo $matches[2]; ?> <?php preg_match("/^http://.+@(.+)$/","http://info@pcds.co.in",$matches); echo $matches[1]; ?>

Create customized index page in XAMPP and WAMPP

Copy and paste the editor save as index.php lets see the magic:- 1).In WAMP means save in WWW folder 2).In XAMPP means save in HTDOCS folder <html> <!–http://a0.twimg.com/profile_images/1922321976/s3_reasonably_small.jpg–> <body bgcolor=”#FFFFFF”> <title>Projects of  YOURNAME  system</title> <h1 style=”text-decoration:underline” align=”center”><img width=”50″ height=”50″ src=”http://www.gifanimations.com/GA/image/animations/butterflies/butterfly-01.gif“> YOURNAME – 192.168.1.30<img width=”50″ height=”50″ src=”http://www.gifanimations.com/GA/image/animations/butterflies/butterfly-01.gif“>   <div…

How to enable curl in xampp?

You have to modify the php.ini files in your xampp folder. Three files in three different places need to be changed. Follow the following steps to enable curl library with XAMPP in Windows: Step 1: Browse and open the following 3 files C:Program Filesxamppapachebinphp.ini C:Program…

how to convert array into string in php?

PHP Array to String Conversion:  In this PHP tutorial you will learn how to convert an array to string. PHP provides implode() function which helps us to convert array to string. The join() function is an alias of implode() function. Examples will illustrates these functions. …

What is difference between session and cookie in php?

What is difference between session and cookie in php? ——————————————————– Cookies are a means to store information in the end-user’s browser, so that the server can track the end-user. Sessions are also implemented by using cookies, but the actual data is not in the browser;…

Difference between session_register and $_SESSION[] in php?

We can use either session_register or $_SESSION for registering session variable in php. Find below the difference between both of them. session_register() is a function and $_SESSION is a superglobal array. session_register() is used to register a session variable and it works only when register_globals…

PHP interview questions and answers

What does a special set of tags <?= and ?> do in PHP? The output is displayed directly to the browser. What the difference is between include and require?  It’s how they handle failures. If the file is not found by require(), it will cause…

PHP-Mysql Interview Questions

Q:1 How can we submit a form without a submit button? A:1 The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange…

1 7 8 9