Sunday, November 23, 2014

List for some common Linux commands

List for some common Linux commands:
  • A
    • adduser: Add a user to the system
    • addgroup: Add a group to the system
    • alias: Create an alias •
    • apropos: Search Help manual pages (man -k)
    • apt-get: Search for and install software packages (Debian/Ubuntu)
    • aptitude: Search for and install software packages (Debian/Ubuntu)
    • aspell: Spell Checker
    • awk: Find and Replace text, database sort/validate/index
  • B
    • basename: Strip directory and suffix from filenames
    • bash: GNU Bourne-Again SHell
    • bc: Arbitrary precision calculator language
    • bg: Send to background
    • break: Exit from a loop •
    • builtin: Run a shell builtin
    • bzip2: Compress or decompress named file(s)
  • C
    • cal: Display a calendar
    • case: Conditionally perform a command
    • cat: Display the contents of a file
    • cd: Change Directory
    • cfdisk: Partition table manipulator for Linux
    • chgrp: Change group ownership
    • chmod: Change access permissions
    • chown: Change file owner and group
    • chroot: Run a command with a different root directory
    • chkconfig: System services (runlevel)
    • cksum: Print CRC checksum and byte counts
    • clear: Clear terminal screen
    • cmp: Compare two files
    • comm: Compare two sorted files line by line
    • command: Run a command - ignoring shell functions •
    • continue: Resume the next iteration of a loop •
    • cp: Copy one or more files to another location
    • cron: Daemon to execute scheduled commands
    • crontab: Schedule a command to run at a later time
    • csplit: Split a file into context-determined pieces
    • cut: Divide a file into several parts
  • D
    • date: Display or change the date & time
    • dc: Desk Calculator
    • dd: Convert and copy a file, write disk headers, boot records
    • ddrescue: Data recovery tool
    • declare: Declare variables and give them attributes •
    • df: Display free disk space
    • diff: Display the differences between two files
    • diff3: Show differences among three files
    • dig: DNS lookup
    • dir: Briefly list directory contents
    • dircolors: Colour setup for "ls"
    • dirname: Convert a full pathname to just a path
    • dirs: Display list of remembered directories
    • dmesg: Print kernel & driver messages
    • du: Estimate file space usage
  • E
    • echo: Display message on screen •
    • egrep: Search file(s) for lines that match an extended expression
    • eject: Eject removable media
    • enable: Enable and disable builtin shell commands •
    • env: Environment variables
    • ethtool: Ethernet card settings
    • eval: Evaluate several commands/arguments
    • exec: Execute a command
    • exit: Exit the shell
    • expect: Automate arbitrary applications accessed over a terminal
    • expand: Convert tabs to spaces
    • export: Set an environment variable
    • expr: Evaluate expressions
  • F
    • false: Do nothing, unsuccessfully
    • fdformat: Low-level format a floppy disk
    • fdisk: Partition table manipulator for Linux
    • fg: Send job to foreground
    • fgrep: Search file(s) for lines that match a fixed string
    • file: Determine file type
    • find: Search for files that meet a desired criteria
    • fmt: Reformat paragraph text
    • fold: Wrap text to fit a specified width.
    • for: Expand words, and execute commands
    • format: Format disks or tapes
    • free: Display memory usage
    • fsck: File system consistency check and repair
    • ftp: File Transfer Protocol
    • function: Define Function Macros
    • fuser: Identify/kill the process that is accessing a file
  • G
    • gawk: Find and Replace text within file(s)
    • getopts: Parse positional parameters
    • grep: Search file(s) for lines that match a given pattern
    • groups: Print group names a user is in
    • gzip: Compress or decompress named file(s)
  • H
    • hash: Remember the full pathname of a name argument
    • head: Output the first part of file(s)
    • help: Display help for a built-in command •
    • history: Command History
    • hostname: Print or set system name
  • I
    • id: Print user and group id's
    • if: Conditionally perform a command
    • ifconfig: Configure a network interface
    • ifdown: Stop a network interface
    • ifup: Start a network interface up
    • import: Capture an X server screen and save the image to file
    • install: Copy files and set attributes
  • J
    • jobs: List active jobs •
    • join: Join lines on a common field
  • K
    • kill: Stop a process from running
    • killall: Kill processes by name
  • L
    • less: Display output one screen at a time
    • let: Perform arithmetic on shell variables •
    • ln: Make links between files
    • local: Create variables •
    • locate: Find files
    • logname: Print current login name
    • logout: Exit a login shell •
    • look: Display lines beginning with a given string
    • lpc: Line printer control program
    • lpr: Off line print
    • lprint: Print a file
    • lprintd: Abort a print job
    • lprintq: List the print queue
    • lprm: Remove jobs from the print queue
    • ls: List information about file(s)
    • lsof: List open files
  • M
    • make: Recompile a group of programs
    • man: Help manual
    • mkdir: Create new folder(s)
    • mkfifo: Make FIFOs (named pipes)
    • mkisofs: Create an hybrid ISO9660/JOLIET/HFS filesystem
    • mknod: Make block or character special files
    • more: Display output one screen at a time
    • mount: Mount a file system
    • mtools: Manipulate MS-DOS files
    • mtr: Network diagnostics (traceroute/ping)
    • mv: Move or rename files or directories
    • mmv: Mass Move and rename (files)
  • N
    • netstat: Networking information
    • nice: Set the priority of a command or job
    • nl: Number lines and write files
    • nohup: Run a command immune to hangups
    • notify-send: Send desktop notifications
    • nslookup: Query Internet name servers interactively
  • O
    • open: Open a file in its default application
    • op: Operator access
  • P
    • passwd: Modify a user password
    • paste: Merge lines of files
    • pathchk: Check file name portability
    • ping: Test a network connection
    • pkill: Stop processes from running
    • popd: Restore the previous value of the current directory
    • pr: Prepare files for printing
    • printcap: Printer capability database
    • printenv: Print environment variables
    • printf: Format and print data •
    • ps: Process status
    • pushd: Save and then change the current directory
    • pwd: Print Working Directory
  • Q
    • quota: Display disk usage and limits
    • quotacheck: Scan a file system for disk usage
    • quotactl: Set disk quotas
  • R
    • ram: ram disk device
    • rcp: Copy files between two machines
    • read: Read a line from standard input •
    • readarray: Read from stdin into an array variable •
    • readonly: Mark variables/functions as readonly
    • reboot: Reboot the system
    • rename: Rename files
    • renice: Alter priority of running processes
    • remsync: Synchronize remote files via email
    • return: Exit a shell function
    • rev: Reverse lines of a file
    • rm: Remove files
    • rmdir: Remove folder(s)
    • rsync: Remote file copy (Synchronize file trees)
  • S
    • screen: Multiplex terminal, run remote shells via ssh
    • scp: Secure copy (remote file copy)
    • sdiff: Merge two files interactively
    • sed: Stream Editor
    • select: Accept keyboard input
    • seq: Print numeric sequences
    • set: Manipulate shell variables and functions
    • sftp: Secure File Transfer Program
    • shift: Shift positional parameters
    • shopt: Shell Options
    • shutdown: Shutdown or restart linux
    • sleep: Delay for a specified time
    • slocate: Find files
    • sort: Sort text files
    • source: Run commands from a file
    • split: Split a file into fixed-size pieces
    • ssh: Secure Shell client (remote login program)
    • strace: Trace system calls and signals
    • su: Substitute user identity
    • sudo: Execute a command as another user
    • sum: Print a checksum for a file
    • suspend: Suspend execution of this shell •
    • symlink: Make a new name for a file
    • sync: Synchronize data on disk with memory
  • T
    • tail: Output the last part of files
    • tar: Tape Archiver
    • tee: Redirect output to multiple files
    • test: Evaluate a conditional expression
    • time: Measure Program running time
    • times: User and system times
    • touch: Change file timestamps
    • top: List processes running on the system
    • traceroute: Trace Route to Host
    • trap: Run a command when a signal is set(bourne)
    • tr: Translate, squeeze, and/or delete characters
    • true: Do nothing, successfully
    • tsort: Topological sort
    • tty: Print filename of terminal on stdin
    • type: Describe a command •
  • U
    • ulimit: Limit user resources •
    • umask: Users file creation mask
    • umount: Unmount a device
    • unalias: Remove an alias •
    • uname: Print system information
    • unexpand: Convert spaces to tabs
    • uniq: Uniquify files
    • units: Convert units from one scale to another
    • unset: Remove variable or function names
    • unshar: Unpack shell archive scripts
    • until: Execute commands (until error)
    • useradd: Create new user account
    • usermod: Modify user account
    • users: List users currently logged in
    • uuencode: Encode a binary file
    • uudecode: Decode a file created by uuencode
  • V
    • v: Verbosely list directory contents ("ls -l -b")
    • vdir: Verbosely list directory contents ("ls -l -b")
    • vi: Text Editor
    • vmstat: Report virtual memory statistics
  • W
    • watch: Execute/display a program periodically
    • wc: Print byte, word, and line counts
    • whereis: Search the user's $path, man pages and source files for a program
    • which: Search the user's $path for a program file
    • while: Execute commands
    • who: Print all usernames currently logged in
    • whoami: Print the current user id and name (`id -un')
    • Wget: Retrieve web pages or files via HTTP, HTTPS or FTP
    • write: Send a message to another user
  • X and onwaard
    • xargs: Execute utility, passing constructed argument list(s)
    • xdg-open: Open a file or URL in the user's preferred application.
    • yes: Print a string until interrupted
    • .: Run a command script in the current shell. ### allows you to remark or comment without disturbing the Terminal.

Codeigniter interview questions and answers

1- What is codeigniter? 
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
2- What are the features of codeigniter?
  1. Codeigniter is free to use,its an open source framework.
  2. Model-View-Controller Based System.
  3. Extremely Light Weight.
  4. Full Featured database classes with support for several platforms..
  5. CodeIgniter is Extensible.The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.
  6. Excelent documentation.
  7. Full Featured database classes with support for several platforms,Security and XSS Filtering,Error Logging.
3- Explain Codeigniter File Structure?
following are the folder structure :-
  • application
    • cache
    • Config
    • Controllers
    • core
    • errors
    • helpers
    • hooks
    • language
    • libraries
    • logs
    • models
    • thirdparty
    • views
  • system
    • core
    • database
    • fonts
    • helpers
    • language
    • libraries
4- Explain Application Flow Chart in codeigniter?
The following graphic illustrates how data flows throughout the system:
CodeIgniter application flow
  1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
  2.  The Router examines the HTTP request to determine what should be done with it.
  3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
  4.  Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
  5. The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request.
  6. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.
5- Explain MVC in Codeigniter?
CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
  • The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.
  • The View is the information that is being presented to a user.
    A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".
  • The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
6- What are the hooks in codeigniter?
CodeIgniter's Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. There may be instances, however, where you'd like to cause some action to take place at a particular stage in the execution process. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of your own scripts in some other location.
The hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:
$config['enablehooks'] = TRUE;
7. How you will load an model in codeigniter?
$this->load->model('Modelname');
8- What are the helpers in codeigniter?
Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpershelp you deal with files, etc.
Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions.
Loading a helper file is quite simple using the following function:
$this->load->helper('name');
9- How you will use or add codeigniter libraries?
When we use the term "Libraries" we are normally referring to the classes that are located in the libraries directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.
10. How you will work with error handling in codeigniter?
CodeIgniter lets you build error reporting into your applications using the functions described below. In addition, it has an error logging class that permits error and debugging messages to be saved as text files.
showerror('message' [, int $statuscode= 500 ] )
This function will display the error message supplied to it using template application/errors/errorgeneral.php.
show404('page' [, 'logerror'])

This function will display the 404 error message supplied to it using template application/errors/error404.php.
logmessage('level', 'message')

This function lets you write messages to your log files. You must supply one of three "levels" in the first parameter, indicating what type of message it is (debug, error, info), with the message itself in the second parameter.

Note: This article is taken from "http://www.programmerdesk.com/blog/detail/33/Codeigniter-interview-questions-and-answers#.VHGxcouUfkU" 

OOP Interview Questions and Answers

1.       What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
  
2.       Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
  1. Abstraction.
  2. Encapsulation.
  3. Inheritance.
  4. Polymorphism.
 3.       What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.
 
4.       What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
 
5.       What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public,Protected, Private, Internal and Protected Internal.
 
6.       What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
 
7.       What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. Ifinheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
 
8.       What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
 
9.       Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules forconstructor are:.
  • Constructor Name should be same asclass name.
  • Constructor must have no return type.

10.   Define Destructor?
Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name.
 
11.   What is Inline function?
Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.
 
12.   What is avirtual function?
Virtual function is a member function ofclass and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.
Virtual function can be achieved in C++, and it can be achieved in C Languageby using function pointers or pointers to function.
 
13.   What isfriend function?
Friend function is a friend of a class that is allowed to access to Public, private or protected data in that same class. If the function is defined outside the class cannot access such information.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public or protected.
 
14.   What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allowscreation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
 
15.   What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
Example:
class complex {
double real, imag;
public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}
a=1.2, b=6
 
16.   What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible withabstract class , but it can be inherited. An abstract class can contain only Abstract method.
 
17.   What is a ternary operator?
Ternary operator is said to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called asconditional operator.
 
18.   What is the use of finalize method?
Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class.
 
19.   What are different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
  • Call by Value – Value passed will get modified only inside the function , and it returns the same value whatever it is passed it into the function.
  • Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.
 
 
20.   What is super keyword?
Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.
It also forwards a call from a constructor to a constructor in the superclass.
 
21.   What is method overriding?
Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.
 
22.   What is an interface?
An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface.
 
23.   What is exception handling?
Exception is an event that occurs during the execution of a program. Exceptions can be of any type – Run time exception, Error exceptions. Those exceptions are handled properly through exception handling mechanism like try, catch and throw keywords.
 
24.   What are tokens?
Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens.
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.
 
25.   Difference between overloading and overriding?
Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself.
Overriding is the same method names with same arguments and return types associates with the class and its child class.
 
26.   Difference between class and an object?
An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.
Class can have sub-classes, and an object doesn’t have sub-objects.
 
27.   What is an abstraction?
Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class.
 
28.   What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:.
  •  Private.
  • Protected.
  • Public.
  • Friend.
  • Protected Friend.
29.   What is sealed modifiers?
Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members.
 
30.   How can we call the base method without creating an instance?
Yes, it is possible to call the base method without creating an instance. And that method should be,.
Static method.
Doing inheritance from that class.-Use Base Keyword from derived class.
 
31.   What is the difference between new and override?
The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.
 
32.   What are the various types of constructors?
There are three various types of constructors , and they are as follows:.
-          Default Constructor – With no parameters.
-          Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
-          Copy Constructor – Which creates a new object as a copy of an existing object.
 
33.   What is early and late binding?
Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time.
 
34.   What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object.
 
35.   What is the difference betweenstructure and a class?
Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for dataand it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation.
 
36.   What is the default access modifier in a class?
The default access modifier of a class is Private by default.
 
37.   What is pure virtual function?
A pure virtual function is a function which can be overridden in the derived classbut cannot be defined. A virtual function can be declared as Pure by using the operator =0.
Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual
 
38.   What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.
  1. Scope Resolution (:: )
  2. Member Selection (.)
  3. Member selection through a pointer to function (.*)
 
39.   What is dynamic or run time polymorphism?
Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name,same signature but with different implementation.
 
40.   Do we require parameter for constructors?
No, we do not require parameter for constructors.
 
41.   What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system.
 
42.   What does the keyword virtual represented in the method definition?
It means, we can override the method.
 
43.   Whether static method can use non static members?
False.
 
44.   What arebase class, sub class and super class?
Base class is the most generalized class , and it is said to be a root class.
Sub class is a class that inherits from one or more base classes.
Super class is the parent class from which another class inherits.
 
45.   What is static and dynamic binding?
Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is also called as Late Binding.
 
46.   How many instances can be created for an abstract class?
Zero instances will be created for an abstract class.
 
47.   Which keyword can be used for overloading?
Operator keyword is used for overloading.
 
48.   What is the default access specifier in a class definition?
Private access specifier is used in a class definition.
 
49.   Which OOPS concept is used as reuse mechanism?
Inheritance is the OOPS concept that can be used as reuse mechanism.
 
50.   Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction

PHP-MySQL Interview Question

Q:1 What are the differences between Get and post methods in form submitting.
give the case where we can use get and we can use post methods?
A:1
–>If the processing of a form is idempotent (i.e. it has no lasting observable effect on the state of the world), then the form method should be GET. Many database searches have no visible side-effects and make ideal applications of query forms.

–>If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST.
How the form data is transmitted?
I would prefer POST when I don’t want the status to be change when user resubmits. And GET when it does not matter.
Q:2 Who is the father of PHP and explain the changes in PHP versions?
A:2 Rasmus Lerdorf is known as the father of PHP.PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additionalOOP features.
Q:3 How can we submit a form without a submit button?
A:3 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 events of different inputs and perform the form submission. you can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites).
Q:4 In how many ways we can retrieve the data in the result set of MySQL using PHP?
A:4 You can do it by 4 Ways
1. mysqlfetchrow.
2. mysqlfetcharray
3. mysqlfetchobject
4. mysqlfetchassoc
Q:5 What is the difference between mysqlfetchobject and mysqlfetcharray?
A:5 mysqlfetchobject() is similar tomysqlfetcharray(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their
offsets (numbers are illegal property names).
Q:6 What is the difference between $message and $$message?
A:6 It is a classic example of PHP’s variable variables. take the following example.$message = “Mizan”;$$message = “is a moderator of PHPXperts.”;$message is a simple PHP variable that we are used to. But the $$message is not a very familiar face. It creates a variable name $mizan with the value “is a moderator of PHPXperts.” assigned. break it like this${$message} => $mizanSometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically.
Q:7 How can we extract string ‘abc.com ‘ from a string ‘http://info@abc.com’
using regular expression of PHP?
A:7 pregmatch(“/^http://.+@(.+)$/”,’http://info@abc.com’,$found);
echo $found[1];
Q:8 How can we create a database using PHP and MySQL?
A:8 We can create MySQL database with the use of
mysql
createdb(“Database Name”)
Q:9 What are the differences between require and include, includeonce and requireonce?
A:9 The include() statement includes and evaluates the specified file.The documentation below also applies to require().
The two constructs are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, use require() if you want a missing file to halt processing of the page.
include() does not behave this way, the script will continue regardless.
The includeonce() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once.includeonce() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc.
requireonce() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc.
Q:10 Can we use include (”abc.PHP”) two times in a PHP page “makeit.PHP”?
A:10 Yes we can use include() more than one time in any page though it is not a very good practice.
Q: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)) ?
A:11 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 and as a result if we do not specify the table name explicitly it will be assigned to the default engine.
Q:12 Functions in IMAP, POP3 AND LDAP?
A:12 You can find these specific information in PHP Manual.
Q:13 How can I execute a PHP script using command line?
A:13 As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program. Be aware that if your PHP script was written for the Web CGI interface,it may not execute properly in command line environment.
Q:14 Suppose your Zend engine supports the mode Then how can u configure your PHP Zend engine to support mode ?
A:14 In php.ini file:
set
shortopentag=on
to make PHP support
Q:15 Shopping cart online validation i.e. how can we configure Paypal, etc.?
Q:15 Shopping cart online validation i.e. how can we configure Paypal, etc.?
A:15 We can find the detail documentation about different paypal integration process at the following site
PayPal PHP
SDK : http://www.paypaldev.org
Q:16 What is meant by nl2br()?
A:16 Inserts HTML line breaks before all newlines in a string string nl2br (string); Returns string with ” inserted before all newlines. For example: echo nl2br(“god blessn you”) will output “god bless you” to your browser.
Q:17 Draw the architecture of Zend engine?
A:17 The Zend Engine is the internal compiler and runtime engine used by PHP4. Developed by Zeev Suraski and Andi Gutmans, the Zend Engine is an abbreviation of their names. In the early days of PHP4, it worked as follows:
The PHP script was loaded by the Zend Engine and compiled into Zend opcode. Opcodes, short for operation codes, are low level binary instructions. Then the opcode was executed and the HTML generated sent to the client. The opcode was flushed from memory after execution.Today, there are a multitude of products and techniques to help you speed up this process. In the following diagram, we show the how modern PHP scripts work; all the shaded boxes are optional. PHP Scripts are loaded into memory and compiled into Zend opcodes.
Q:18 What are the current versions of apache, PHP, and MySQL?
A:18 As of February, 2007 the current versions arePHP: php5.2.1 MySQL: MySQL 5.2 Apache: Apache 2.2.4Note: visit www.php.net,
http://dev.mysql.com/downloads/mysql/,
www.apache.org to get current versions.
Q:19 What are the reasons for selecting lamp (Linux, apache, MySQL,PHP) instead of combination of other software programs, servers and operating systems?
A:19 All of those are open source resource. Security of Linux is very very more than windows. Apache is a better server that IIS both in functionality and security. MySQL is world most popular open source database. PHP is more faster that asp or any other scripting language.
Q:20 How can we encrypt and decrypt a data present in a MySQL table using MySQL?
A:20 AESENCRYPT () and AESDECRYPT ()
Q:21 How can we encrypt the username and password using PHP?
A:21 The functions in this section perform encryption and decryption, and
compression and uncompression:

encryption decryption
AESENCRYT() AESDECRYPT()
ENCODE() DECODE()
DESENCRYPT() DESDECRYPT()
ENCRYPT() Not available
MD5() Not available
OLDPASSWORD() Not available
PASSWORD() Not available
SHA() or SHA1() Not available
Not available UNCOMPRESSED
LENGTH()

Q:22 What are the features and advantages of object-oriented
programming?
A:22 One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that
manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system

Q:23 What are the differences between procedure-oriented languages and
object-oriented languages?
A:23 Traditional programming has the following characteristics:Functions are written sequentially, so that a change in programming can affect any code that follows it. If a function is used multiple times in a system (i.e., a piece of code
that manages the date), it is often simply cut and pasted into each program (i.e., a change log, order function, fulfillment system, etc). If a date change is needed (i.e., Y2K when the code needed to be changed to handle four numerical digits instead of two), all these pieces of code must be found, modified, and tested. Code (sequences of computer instructions) and data (information on which the instructions operates on) are kept separate. Multiple sets of code can access and modify one set of data. One set of code may rely on data in multiple places. Multiple sets of code and data are required to work together. Changes made to any of the code sets and data sets can cause problems through out the system.Object-Oriented programming takes a radically different approach:Code and data are merged into one indivisible item – an object (the term “component” has also been used to describe an object.) An object is an abstraction of a set of real-world things (for example, an object may be created around “date”) The object would contain all information and functionality for that thing (A date object it may contain labels like January, February, Tuesday, Wednesday.
It may contain functionality that manages leap years, determines if it is a business day or a holiday, etc., See Fig. 1). Ideally, information about a particular thing should reside in only one place in a system. The information within an object is encapsulated (or hidden) from the rest of the system.
A system is composed of multiple objects (i.e., date function, reports, order processing, etc., See Fig 2). When one object needs information from another object, a request is sent asking for specific information. (for example, a report object may need to know what today’s date is and will send a request to the date object) These requests are called messages and each object has an interface that manages messages. OO programming languages include features such as “class”, “instance”, “inheritance”, and “polymorphism” that increase the power and flexibility of an object.

Q:24 What is the use of friend function?
A:24 Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class.
A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match.

Q:25 What are the differences between public, private, protected,
static, transient, final and volatile?
A:25 Public: Public declared items can be accessed everywhere.
Protected: Protected limits access to inherited and parent classes (and to the class that defines the item).
Private: Private limits visibility only to the class that defines the item.
Static: A static variable exists only in a local function scope, but it does not lose its value when program execution leaves this scope.
Final: Final keyword prevents child classes from overriding a method by prefixing the definition with final. If the class itself is being defined final then it cannot be extended.
transient: A transient variable is a variable that may not be serialized.
volatile: a variable that might be concurrently modified by multiple threads should be declared volatile. Variables declared to be volatile will not be optimized by the compiler because their value can change at any time.

Q:26 What are the different types of errors in PHP?
A:26 Three are three types of errors:1. Notices: These are trivial, non-critical errors that PHP encounters while executing a script – for example, accessing a variable that has not yet been defined. By default, such errors are not displayed to the user at all – although, as you will see, you can change this default behavior.
2. Warnings: These are more serious errors – for example, attempting to include() a file which does not exist. By default, these errors are displayed to the user, but they do not result in script termination.
3. Fatal errors: These are critical errors – for example, instantiating an object of a non-existent class, or calling a non-existent function. These errors cause the immediate termination of  the script, and PHP’s default behavior is to display them to the user when they take place.

Q:27 What is the functionality of the function strstr and stristr?
A:27 strstr:

Returns part of haystack string from the first occurrence of needle to the end of haystack.If needle is not found, returns FALSE.

If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.

This function is case-sensitive. For case-insensitive searches, use stristr().

Q:28 What are the differences between PHP 3 and PHP 4 and PHP 5?
A:28 Please read the release notes at http://www.php.net.

Q:29 How can we convert asp pages to PHP pages?
A:29 there are lots of tools available for asp to PHP conversion. you can search Google for that. the best one is available athttp://asp2php.naken.cc./

Q:30 What is the functionality of the function htmlentities?
A:30 Convert all applicable characters to HTML entities This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.

Q:31 How can we get second of the current time using date function?
A:31 $second = date("s");
Q:32 What is meant by urlencode and urldocode?
A:32 URLencode returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type.
urldecode decodes any %## encoding in the given string.

Q:33 What is the difference between the functions unlink and unset?
A:33 unlink() deletes the given file from the file system. unset() makes a variable undefined.

Q:34 How can we register the variables into a session?
A:34 $SESSION[’name’] = “Mizan”;

Q:35 How can we get the properties (size, type, width, height) of an image using PHP image functions?
A:35 To know the Image type use exif
imagetype () function
To know the Image size use getimagesize () function
To know the image width use imagesx () function
To know the image height use imagesy() function t

Q:36 How can we get the browser properties using PHP?
A:36 By using $SERVER['HTTPUSERAGENT'] variable.

Q:37 What is the maximum size of a file that can be uploaded using PHP and how can we change this?
A:37 By default the maximum size is 2MB. and we can change the following setup at php.iniupload
maxfilesize = 2M

Q:38 How can we increase the execution time of a PHP script?
A:38 by changing the following setup at php.inimax
executiontime = 30 ; Maximum execution time of each script, in seconds

Q:39 How can we take a backup of a MySQL table and how can we restore it. ?
A:39 To backup: BACKUP TABLE tbl
name[,tblname…] TO ‘/path/to/backup/directory’
RESTORE TABLE tbl
name[,tblname…] FROM ‘/path/to/backup/directory’mysqldump: Dumping Table Structure and DataUtility to dump a database or a collection of database for backup or for transferring the data to another SQL server (not necessarily a MySQL server). The dump will contain SQL statements to create the table and/or populate the table.
-t, –no-create-info
Don’t write table creation information (the CREATE TABLE statement).
-d, –no-data
Don’t write any row information for the table. This is very useful if you just want to get a dump of the structure for a table!

Q:40 How can we optimize or increase the speed of a MySQL select query?
A:40
* first of all instead of using select * from table1, use select column1, column2, column3.. from table1
* Look for the opportunity to introduce index in the table you are querying.
* use limit keyword if you are looking for any specific number of rows from the result set.

Q:41 How many ways can we get the value of current session id?
A:41 session
id() returns the session id for the current session.

Q:42 How can we destroy the session, how can we unset the variable of a session?
A:42 sessionunregister — Unregister a global variable from the current session sessionunset — Free all session variables

Q:43 How can we destroy the cookie?
A:43 Set the cookie in past.

Q:44 How many ways we can pass the variable through the navigation between the pages?
A:44
* GET/QueryString
* POST

Q:45 What is the difference between eregreplace() and eregireplace()?
A:45 eregireplace() function is identical to eregreplace() except that this ignores case distinction when matching alphabetic characters.eregireplace() function is identical to eregreplace() except that this ignores case distinction when matching alphabetic characters.

Q:46 What are the different functions in sorting an array?
A:46 Sort(), arsort(), asort(), ksort(), natsort(), natcasesort(), rsort(), usort(), arraymultisort(), and uksort().

Q:47 How can we know the count/number of elements of an array?
A:47 2 ways
a) sizeof($urarray) This function is an alias of count()
b) count($urarray)

Q:48 What is the PHP predefined variable that tells the What types of
images that PHP supports?
A:48 Though i am not sure if this is wrong or not, With the exif extension you are able to work with image meta data.

Q:49 How can I know that a variable is a number or not using a JavaScript?
A:49 bool is
numeric ( mixed var) Returns TRUE if var is a number or a numeric string, FALSE otherwise.or use isNaN(mixed var)The isNaN() function is used to check if a value is not a number.

Q:50 List out some tools through which we can draw E-R diagrams for mysql.
A:51 Case Studio
Smart Draw

Q:51 How can I retrieve values from one database server and store them in other database server using PHP?

A:51 we can always fetch from one database and rewrite to another. here is a nice solution of it.
$db1 = mysqlconnect(“host”,”user”,”pwd”)
mysql
selectdb(“db1″, $db1);
$res1 = mysql
query(“query”,$db1);$db2 = mysqlconnect(“host”,”user”,”pwd”)
mysql
selectdb(“db2″, $db2);
$res2 = mysql
query(“query”,$db2);At this point you can only fetch records from you previous ResultSet,
i.e $res1 – But you cannot execute new query in $db1, even if you
supply the link as because the link was overwritten by the new db.so at this point the following script will fail
$res3 = mysqlquery(“query”,$db1); //this will failSo how to solve that?

take a look below.
$db1 = mysql
connect(“host”,”user”,”pwd”)
mysqlselectdb(“db1″, $db1);
$res1 = mysqlquery(“query”,$db1);

$db2 = mysql
connect(“host”,”user”,”pwd”, true)
mysqlselectdb(“db2″, $db2);
$res2 = mysqlquery(“query”,$db2);

So mysql
connect has another optional boolean parameter which
indicates whether a link will be created or not. as we connect to the
$db2 with this optional parameter set to ‘true’, so both link will
remain live.

now the following query will execute successfully.
$res3 = mysql_query(“query”,$db1);

Thanks goes to Hasan and Hasin for this solution.

Q:52 List out the predefined classes in PHP?
A:52 Directory
stdClass
__PHP_Incomplete_Class
exception
php_user_filter

Q:53 How can I make a script that can be bi-language (supports English, German)?
A:53 You can maintain two separate language file for each of the language. all the labels are putted in both language files as variables and assign those variables in the PHP source. on runtime choose the
required language option.

Q:54 What are the difference between abstract class and interface?
A:54 Abstract class: abstract classes are the class where one or more methods are abstract but not necessarily all method has to be abstract. Abstract methods are the methods, which are declare in its class but not define. The definition of those methods must be in its extending class.Interface: Interfaces are one type of class where all the methods are abstract. That means all the methods only declared but not defined. All the methods must be define by its implemented class.

Q:55 How can we send mail using JavaScript?
A:55 JavaScript does not have any networking capabilities as it is designed to work on client site. As a result we can not send mails using JavaScript. But we can call the client side mail protocol mailto via JavaScript to prompt for an email to send. this requires the client to approve it.

Q:56 How can we repair a MySQL table?
A:56 The syntex for repairing a MySQL table is REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended] This command will repair the table specified if the quick is given the MySQL will do a repair of only the index tree if the extended is given it will create index row by row

Q:57 What are the advantages of stored procedures, triggers, indexes?
A:57 A stored procedure is a set of SQL commands that can be compiled and stored in the server. Once this has been done, clients don’t need to keep re-issuing the entire query but can refer to the stored procedure.
This provides better overall performance because the query has to be parsed only once, and less information needs to be sent between the server and the client. You can also raise the conceptual level by having libraries of functions in the server. However, stored procedures of course do increase the load on the database server system, as more of the work is done on the server side and less on the client (application) side.Triggers will also be implemented. A trigger is effectively a type of stored procedure, one that is invoked when a particular event occurs.
For example, you can install a stored procedure that is triggered each time a record is deleted from a transaction table and that stored procedure automatically deletes the corresponding customer from a
customer table when all his transactions are deleted.Indexes are used to find rows with specific column values quickly. Without an index, MySQL must begin with the first row and then read through the entire table to find the relevant rows. The larger the table, the more this costs. If the table has an index for the columns in question, MySQL can quickly determine the position to seek to in the middle of the data file without having to look at all the data. If a table has 1,000 rows, this is at least 100 times faster than reading sequentially. If you need to access most of the rows, it is faster to read sequentially, because this minimizes disk seeks.

Q:58 What is the maximum length of a table name, database name, and fieldname in MySQL?
A:58 The following table describes the maximum length for each type of identifier.

Identifier Maximum Length
(bytes)
Database 64
Table 64
Column 64
Index 64
Alias 255

There are some restrictions on the characters that may appear in identifiers:

Q:59 How many values can the SET function of MySQL take?
A:59 MySQL set can take zero or more values but at the maximum it can take 64 values

Q:60 What are the other commands to know the structure of table using MySQL commands except explain command?
A:60 describe Table-Name;

Q:61 How many tables will create when we create table, what are they?
A:61 The ‘.frm’ file stores the table definition.
The data file has a ‘.MYD’ (MYData) extension.
The index file has a ‘.MYI’ (MYIndex) extension,

Q:62 What is the purpose of the following files having extensions 1) .frm 2) .myd 3) .myi? What do these files contain?
A:62 In MySql, the default table type is MyISAM. Each MyISAM table is stored on disk in three files. The files have names that begin with the table name and have an extension to indicate the
file type.
The ‘.frm’ file stores the table definition.
The data file has a ‘.MYD’ (MYData) extension.
The index file has a ‘.MYI’ (MYIndex) extension,

Q:63 What is maximum size of a database in MySQL?
A:63 If the operating system or filesystem places a limit on the number of files in a directory, MySQL is bound by that constraint.The efficiency of the operating system in handling large numbers of files in a directory can place a practical limit on the number of tables in a database. If the time required to open a file in the directory increases significantly as the number of files increases, database performance can be adversely affected. The amount of available disk space limits the number of tables.
MySQL 3.22 had a 4GB (4 gigabyte) limit on table size. With the MyISAM storage engine in MySQL 3.23, the maximum table size was increased to 65536 terabytes (2567 – 1 bytes). With this larger allowed table size, the maximum effective table size for MySQL databases is usually determined by operating system constraints on file sizes, not by MySQL internal limits.The InnoDB storage engine maintains InnoDB tables within a tablespace that can be created from several files. This allows a table to exceed the maximum individual file size. The tablespace can include raw disk partitions, which allows extremely large tables. The maximum tablespace size is 64TB.
The following table lists some examples of operating system file-size limits. This is only a rough guide and is not intended to be definitive. For the most up-to-date information, be sure to check the documentation
specific to your operating system.
Operating System File-size LimitLinux 2.2-Intel 32-bit 2GB (LFS: 4GB)
Linux 2.4+ (using ext3 filesystem) 4TB
Solaris 9/10 16TB
NetWare w/NSS filesystem 8TB
Win32 w/ FAT/FAT32 2GB/4GB
Win32 w/ NTFS 2TB (possibly larger)
MacOS X w/ HFS+ 2TB

Q:64 Give the syntax of Grant and Revoke commands?
A:64 The generic syntax for grant is as following
> GRANT [rights] on [database/s] TO [username@hostname] IDENTIFIED BY [password]
now rights can be
a) All privileges
b) combination of create, drop, select, insert, update and delete etc.We can grant rights on all databse by using *.* or some specific database by database.* or a specific table by database.table_name
username@hotsname can be either username@localhost, username@hostname and username@% where hostname is any valid hostname and % represents any name, the *.* any condition
password is simply the password of userThe generic syntax for revoke is as following
> REVOKE [rights] on [database/s] FROM [username@hostname]
now rights can be as explained above
a) All privileges
b) combination of create, drop, select, insert, update and delete etc.
username@hotsname can be either username@localhost, username@hostname and username@%
where hostname is any valid hostname and % represents any name, the *.* any condition

Q:65 Explain Normalization concept?
A:65 The normalization process involves getting our data to conform to three progressive normal forms, and a higher level of normalization cannot be achieved until the previous levels have been achieved (there
are actually five normal forms, but the last two are mainly academic and will not be discussed).First Normal FormThe First Normal Form (or 1NF) involves removal of redundant data from horizontal rows. We want to ensure that there is no duplication of data in a given row, and that every column stores the least amount of information possible (making the field atomic).Second Normal FormWhere the First Normal Form deals with redundancy of data across a horizontal row, Second Normal Form (or 2NF) deals with redundancy of data in vertical columns. As stated earlier, the normal forms are progressive, so to achieve Second Normal Form, your tables must already be in First Normal Form.Third Normal Form 


I have a confession to make; I do not often use Third Normal Form. In Third Normal Form we are looking for data in our tables that is not fully dependant on the primary key, but dependant on another value in
the table

Q:66 How can we find the number of rows in a table using MySQL?
A:66 Use this for mysql
>SELECT COUNT(*) FROM table_name;

Q:67 How can we find the number of rows in a result set using PHP?
A:67 $result = mysql_query($sql, $db_link);
$num_rows = mysql_num_rows($result);
echo "$num_rows rows found";

Q:68 How many ways we can we find the current date using MySQL?
A:68 SELECT CURDATE();
CURRENT_DATE() = CURDATE()
for time use
SELECT CURTIME();
CURRENT_TIME() = CURTIME()

Q:69 What are the advantages/disadvantages of MySQL and PHP?
A:69 Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP.

Q:70 What is the difference between GROUP BY and ORDER BY in Sql?
A:70 ORDER BY [col1],[col2],…,[coln]; Tels DBMS according to what columns it should sort the result. If two rows will hawe the same value in col1 it will try to sort them according to col2 and so on.GROUP BY
[col1],[col2],…,[coln]; Tels DBMS to group results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average

Q:71 What is the difference between char and varchar data types?
A:71 Set char to occupy n bytes and it will take n bytes even if u r storing a value of n-m bytes Set varchar to occupy n bytes and it will take only the required space and will not use the n bytes
eg. name char(15) will waste 10 bytes if we store ‘mizan’, if each char takes a byte
eg. name varchar(15) will just use 5 bytes if we store ‘mizan’, if each char takes a byte. rest 10 bytes will be free.

Q:72 What is the functionality of md5 function in PHP?
A:72 Calculate the md5 hash of a string. The hash is a 32-character hexadecimal number. I use it to generate keys which I use to identify users etc. If I add random no techniques to it the md5 generated now
will be totally different for the same string I am using.

Q:73 How can I load data from a text file into a table?
A:73 you can use LOAD DATA INFILE file_name; syntax to load data from a text file. but you have to make sure thata) data is delimited
b) columns and data matched correctly

Q:74 How can we know the number of days between two given dates using MySQL?
A:79 SELECT DATEDIFF(’2007-03-07′,’2005-01-01′);

Q:75 How can we know the number of days between two given dates using PHP?
A:80 $date1 = date(‘Y-m-d’);
$date2 = ’2006-08-15′;
$days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);

How to backup and download Database using PHP

< ?php $mysqlUserName = 'databaseusername' ; $mysqlPassword = 'databasepassword' ; $mysqlHostNa...