Monday, March 14, 2016

PHP MySQL Database

With PHP, you can connect to and manipulate databases.

MySQL is the most popular database system used with PHP.

What is MySQL?

  • MySQL is a database system used on the web
  • MySQL is a database system that runs on a server
  • MySQL is ideal for both small and large applications
  • MySQL is very fast, reliable, and easy to use
  • MySQL uses standard SQL
  • MySQL compiles on a number of platforms
  • MySQL is free to download and use
  • MySQL is developed, distributed, and supported by Oracle Corporation
  • MySQL is named after co-founder Monty Widenius's daughter: My
The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows.
Databases are useful for storing information categorically. A company may have a database with the following tables:
  • Employees
  • Products
  • Customers
  • Orders

PHP + MySQL Database System

  • PHP combined with MySQL are cross-platform (you can develop in Windows and serve on a Unix platform)

Database Queries

A query is a question or a request.
We can query a database for specific information and have a recordset returned.
Look at the following query (using standard SQL):
SELECT LastName FROM Employees
The query above selects all the data in the "LastName" column from the "Employees" table.
To learn more about SQL, please visit our SQL tutorial.

Download MySQL Database

If you don't have a PHP server with a MySQL Database, you can download it for free here: http://www.mysql.com

Facts About MySQL Database

MySQL is the de-facto standard database system for web sites with HUGE volumes of both data and end-users (like Facebook, Twitter, and Wikipedia).
Another great thing about MySQL is that it can be scaled down to support embedded database applications.
Look at http://www.mysql.com/customers/ for an overview of companies using MySQL.
Further more follow the following articles

Sunday, March 13, 2016

What is phpDocumentor?

phpDocumentor 2 is a tool that makes it possible to generate documentation directly from your PHP source code. With this you can provide your consumers with more information regarding the functionality embedded within your source and not just what is usable to them from your user interface.

Documentation generated by phpDocumentor 2 does not aim to be a replacement for conventional documentation but is rather supplemental, or reference, documentation.This proves to be useful in the following example situations:
  • Sets of libraries or applications providing an API, such as phpDocumentor 2 itself
  • Frameworks, such as Zend Framework or Symfony
  • Pluggable architectures, such as WordPress or PyroCMS
  • Long-running, complex projects, to help you find the right function or method for the job

Templates

Templates
phpDocumentor 2 contains an incredibly flexible template system which enables you to alter your output in any way imaginable. This can range from simply applying your own branding for the HTML output by merely altering a couple of CSS files to determining which types of output are generated and where they are made available.

Code Analysis

Code Analysis
phpDocumentor 2 is capable of extracting interesting information and presenting it in the form of graphs and reports. The following are currently supported:
  • An inheritance diagram showing all subclassing and implementing of interfaces.
  • Reporting errors in your source code's inline documentation.
  • Reporting which elements are marked as deprecated.
  • Reporting where TODOs are placed in your code and what is to be done.
This list will only grow in the future to help you determine where to invest your resources in order to make your code more stable and maintainable.

Further more follow the following articles

Saturday, March 12, 2016

Re-Implementing the Range Operator in PHP

In the prequel to this article
(hint: make sure you’ve read it first), I showed one way to implement a range
operator in PHP. Initial implementations, however, are rarely the best, and so
it is the intention of this article to look at how the previous implementation
can be improved.

Thanks once again to Nikita Popov for proofreading
this article!

Previous Implementation Drawbacks

The initial implementation put all of the logic for the range operator into the
Zend VM, which forced computation to take place purely at runtime when the
ZEND_RANGE opcode was executed. This not only meant that computation could
not be shifted to compile time for operands that were literal, but also meant
that some features would simply not work.

In this implementation, we will shift the range operator logic out of the Zend
VM to enable for computation to be done at either compile time (for literal
operands) or runtime (for dynamic operands). This will not only provide a small
win for Opcache users, but will more importantly allow for constant expression
features to be used with the range operator.

For example:
// as constant definitions
const AN_ARRAY = 1 |> 100;
// as initial property definitions
class A {
private $a = 1 |> 2;
}
// as default values for optional parameters:
function a($a = 1 |> 2) { // }
So without further ado, let’s reimplement the range operator.

Updating the Lexer

The lexer implementation remains exactly the same. The token is firstly
registered in Zend/zend_language_scanner.l
(line ~1200):

"|>" {
RETURN_TOKEN(T_RANGE);
}
And then declared in Zend/zend_language_parser.y
(line ~220):

%token T_RANGE "|> (T_RANGE)"

Further more follow the following articles


Thursday, March 10, 2016

php training full course content

Course: PHP mySQL (With Framwork CI/LARAVEL)

Duration: 2 Months

Time: 1.5 hour/day (Theory + Practical)

php ci laravel training center in kathmandu/lalitpur
PHP mySQL With Framwrok CI/LARAVEL

1.Introduction to PHP

  1. Introduction to PHP
  2. Introduction to Web Request/Response
  3. Introduction to Variables
  4. Code Comments
  5. Introduction to Data Types
  6. Scalar Data Types (Strings, Integers, Floats) and their built-in Functions
  7. Complex Data Types (Array, Objects) and their built-in Functions
  8. Arrays (Numerical, Associative, Multi-Dimensional)
  9. Constants
  10. Type Casting and Juggling
  11. Conditional Statements (If-else, switch)
  12. Operators (Unary, Binary and Ternary)
  13. Loops (While, Do-while, for and foreach)
  14. User Defined Functions
  15. Function arguments, return values and default values
  16. Function global and local scope
  17. URL encoding / decoding
  18. Introduction to script inclusion with include/include_once, require/require_once
  19. Single form processing
  20. Handling multiple forms
  21. Form validations with PHP
  22. Introduction to Web Cookies and Sessions
  23. 2. Introduction to PHP with MySQLi
  24.                Intermediate PHP with OOP (Object Oriented Programming):
Introduction to Object Oriented PHP
Classes and Objects
Methods and Properties
Constructors and Destructors
Class Inheritance
Access Modifiers (Public, Protected, Private)
Setters and Getters
Static Properties and Methods
Magic Methods
Object Cloning
Abstract classes and Interfaces
Final Classes
Polymorphism
Namespaces
Exceptions and Error Handling
Design Patterns (Singleton, Factory, Dependency Injection, Observer etc.)
SOLID Design Principles
Date and Time Handling using PHP
File System and I/O
Email Sending and Receiving
Using MySQLi (OO Interface) to Access Databases
Using PDO to Access Databases
Developing a CMS with a Blog (Project)
Regular Expressions
Introduction to .htaccess
Controlling Output using .htacces
URL Rewriting
3. Database with Object oriented concept
  1.  Introduction to Databases with MySQL
  2. Using PHP to access MySQL with MySQLi (Procedural) Driver
  3. MySQL CRUD (Create, Read, Update, Delete)
CRUD using PHP 4. PHP dates and time
Introduction to PHP
Evaluation of Php
Basic Syntax
Defining variable and constant
Php Data type
Operator and Expression
Handling Html Form With Php
Capturing Form Data
Dealing with Multi-value filed
Generating File uploaded form
Redirecting a form after submission
Decisions and loop
Making Decisions
Doing Repetitive task with looping
Mixing Decisions and looping with Html
Function
What is a function
Define a function
Call by value and Call by reference
Recursive function
String
Creating and accessing String
Searching & Replacing String
Formatting String
String Related Library function
Array
Anatomy of an Array
Creating index based and Associative array
Accessing array Element
Looping with Index based array
Looping with associative array using each() and foreach()
Some useful Library function
Working with file and Directories
Understanding file& directory
Opening and closing a file
Coping ,renaming and deleting a file
Working with directories
Building a text editor
File Uploading & Downloading
Mini Project (With file Handling)

State management
Using query string(URL rewriting)
Using Hidden field
Using cookies
Using session
String matching with regular expression
What is regular expression
Pattern matching in Php
Replacing text
Splitting a string with a Regular Expression
Generating Images with PHP
Basics of computer Graphics
Creating Image
Manipulating Image
Using text in Image
Database Connectivity with MySql
Introduction to RDBMS
Connection with MySql Database
Performing basic database operation(DML) (Insert, Delete, Update, Select)
Setting query parameter
Executing query
Join (Cross joins, Inner joins, Outer Joins, Self joins.)
Mini Project
5.Javascript / Jquery
6. Payment gateway integration
7. HTML5 (Localstorage / Geolocation) Api

Further more follow the following articles

Wednesday, March 9, 2016

Useful PHP Tips Revisited Link Final Day

9. Use the Suppression Operator Correctly Link

Always try to avoid using the error suppression operator. In the previous article, the author states:
The @ operator is rather slow and can be costly if you need to write code with performance in mind.
Error suppression is slow. This is because PHP dynamically changes error_reporting to 0 before executing the suppressed statement, then immediately changes it back. This is expensive.
Worse, using the error suppression operator makes it difficult to track down the root cause of a problem.
The previous article uses the following example to support the practice of assigning a variable by reference when it is unknown if $albus is set:
<?php
$albert =& $albus;
?>
Although this works — for now — relying on strange, undocumented behavior without a very good understanding of why it works is a good way to introduce bugs. Because $albert is assigned to $albus by reference, future modifications to $albus will also modify $albert.
A much better solution is to use isset(), with braces:
<?php
if (!isset($albus)) {
$albert = NULL;
}
?>
Assigning $albert to NULL is the same as assigning it to a nonexistent reference, but being explicit greatly improves the clarity of the code and avoids the referential relationship between the two variables.
If you inherit code that uses the error suppression operator excessively, we’ve got a bonus tip for you. There is a new PECL extension called Scream that disables error suppression.
Further more details:

  • PHP TRAINING IN KATHMANDU
  • PHP TRAINING IN LALITPUR
  • 10. Use isset() Instead of strlen() Link

    This is actually a neat trick, although the previous article completely fails to explain it. Here is the missing example:
    <?php
    if (isset($username[5])) {
    // The username is at least six characters long.
    }
    ?>
    When you treat strings as arrays, each character in the string is an element in the array. By determining whether a particular element exists, you can determine whether the string is at least that many characters long. (Note that the first character is element 0, so $username[5] is the sixth character in $username.)
    The reason this is slightly faster than strlen() is complicated. The simple explanation is that strlen() is a function, and isset() is a language construct. Generally speaking, calling a function is more expensive than using a language construct.

    Tuesday, March 8, 2016

    Useful PHP Tips Revisited Link Day 5,6,7,8

    5. Favor str_replace() Over ereg_replace() and preg_replace() Link

    We hate to sound disparaging, but this tip demonstrates the sort of misunderstanding that leads to the same misuse it’s trying to prevent. It’s an obvious truth that string functions are faster at string matching than regular expression functions, but the author’s attempt to draw a corollary from this fails miserably:
    If you’re using regular expressions, then ereg_replace() and preg_replace() will be much faster than str_replace().
    Because str_replace() does not support pattern matching, this statement makes no sense. The choice between string functions and regular expression functions comes down to which is fit for purpose, not which is faster. If you need to match a pattern, use a regular expression function. If you need to match a string, use a string function.

    6. Use Ternary Operators Link

    The benefit of the ternary operator is debatable (there’s only one, by the way). Here is a line of code from an audit we performed recently:
    <?php
     
    $host = strlen($host) > 0 ? $host : htmlentities($host);
     
    ?>
    Oops! The author actually means to escape $host if the string length is greater than zero, but instead accidentally does the opposite. Easy mistake to make? Maybe. Easy to miss during a code audit? Certainly. Concision doesn’t necessarily make the code any better.
    The ternary operator may be fine for one-liners, prototypes, and templates, but we strongly believe that an ordinary conditional statement is almost always better. PHP is descriptive and verbose. We think code should be, too.

    7. Memcached Link

    Disk access is slow. Network access is slow. Databases typically use both.
    Memory is fast. Using a local cache avoids the overhead of network and disk access. Combine these truths and you get memcached, a “distributed memory object caching system” originally developed for the Perl-based blogging platform LiveJournal.
    If your application isn’t distributed across multiple servers, you probably don’t need memcached. Simpler caching approaches — serializing data and storing it in a temporary file, for example — can eliminate a lot of redundant work on each request. In fact, this is the sort of low-hanging fruit we consider when helping our clients tune their apps.
    One of the easiest and most universal ways to cache data in memory is to use the shared memory helpers in APC, a caching system originally developed by our colleague George Schlossnagle. Consider the following example:
    <?php
     
    $feed = apc_fetch('news');
     
    if ($feed === FALSE) {
        $feed = file_get_contents('http://example.org/news.xml');
        // Store this data in shared memory for five minutes.
        apc_store('news', $feed, 300);
    }
     
    // Do something with $feed.
     
    ?>
    With this type of caching, you don’t have to wait on a remote server to send the feed data for every request. Some latency is incurred — up to five minutes in this example — but this can be adjusted to as close to real time as your app requires.

    8. Use a Framework Link

    All decisions have consequences. We appreciate frameworks — in fact, the main developers behind CakePHP and Solar work with us at OmniTI — but using one doesn’t magically make what you’re doing better.
    In December, our colleague Paul Jones wrote an article for PHP Advent called The Framework as Franchise, in which he compares frameworks to business franchises. He refers to a suggestion by Michael Gerber from his book “The E-Myth Revisited”:
    Gerber notes that to run a successful business, the entrepreneur needs to act as if he is going to sell his business as a franchise prototype. It is the only way the business owner can make the business operate without him being personally involved in every decision.
    This is good advice. Whether you’re using a framework or defining your own standards and conventions, it’s important to consider the value from the perspective of future developers.
    Although we would love to give you a universal truth, extending this idea to suggest that a framework is always appropriate isn’t something we’re willing to do. If you ask us whether you should use a framework, the best answer we could give is, “It depends.”
    Further more details: 

  • PHP TRAINING IN KATHMANDU
  • PHP TRAINING IN LALITPUR