7. How can we extract string 'abc.com ' from a string 'http://info@abc.com' using regular _expression of php?
Ans:-
preg_match("/^(http:\/\/info@)?([^\/]+)/i","http://info@abc.com", $data);
echo $data[2];
Use the function split split(“@”,”http://info@abc.com”) which returns an array any second element of the returned array will hold the value as abc.com.
8. How can we create a database using php and mysql?
Ans:-
mysql_create_db()
9. What are the differences between require and include, include_once?
Ans:-
File will not be included more than once.
If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.
10. Can we use include ("abc.php") two times in a php page "makeit.php"?
Ans:-
Yes we can include..
11. 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)) ?
Ans:-
Total 5 types of tables we can create
1. MyISAM
2. Heap
3. Merge
4. INNO DB
5. ISAM
MyISAM is the default storage engine as of MySQL 3.23.
Table Types are
· ISAM(Index Sequential Access Method)
· MyISAM
o Static
o Dynamic
o Compress
· Merge
· Heap (Fastest tables because it stores in to the RAM)
· BDB
· InnoDB (Transaction safe table)
When you fire the above create query MySQL will create the Dynamic table.
http://dev.mysql.com/doc/mysql/en/storage-engines.html
MyISAM Table Type is created, if u not specified any table type then default will be applied and MyISAM is default
13. How can I execute a PHP script using command line?
Ans:-
Through php parse you can execute PHP script using command line. By default location of php parser is /var/www/html so set the path of this directory and just use as following
#php sample.php
16. What is meant by nl2br()?
Ans:-
nl2br() inserts html break in string
echo nl2br(”god bless \n you”);
output--
god bless
you
Returns string with ‘’ inserted before all newlines
[Friday, December 21, 2007
|
0
comments
]
Popular Posts
- php questions
- some php questions
- How to create a plugin in elgg.
- php Questions
- Mysql query for searching a value, add weightage on the number of occurances and sort based on the weight-age
- Contact Me
- solving the packaging problem in PHP
- How to add or remove WWW on URLs using htaccess.
- php questions
- Inserting nodes into xml files using XML DOM in PHP .
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.