Posts Tagged ‘database’

New Features in PHP 7

Wednesday, May 2nd, 2018

Programming language and the programmers all over the world experienced a new wave of change when PHP7 launched. This web-based application is compatible with mobile, enterprises solutions, and cloud platforms. However, there are a lot more to learn about this version to get comfortable while programming. It has got two new operators and many more exciting changes to ease the PHP lovers around the globe. Let’s dig out what are those to get a quality knowledge supplement.


First and foremost thing that immediately gets noticed is its speed. PHP7 has an almost double speed of operation as that of PHP 5.6. Regarding consistency, it stands high as compared to its earlier versions. This means you will gain more proficiency than before as unwanted time lags will not be there.

Improved open source scripting:

PHP5 was using Zend Engine II at its heart, but PHP7 has got an upgraded version, Zend Engine III. It can significantly improve the performance level. As it has been written in C that interprets PHP, the functionality gets enhanced. It comes under the code name of PHPNG (Next Generation). This ensures that PHP7 is a must-try affair for every programmer around the globe.

Manual Variable declaration:

PHP 7, unlike its previous shades, enables you to specify your desired variable through its Type Declaration feature. It not only makes your code easy to read but also enables you to make small changes to variables without bringing any effect to the overall result. Earlier, this feature was not present and PHP was automatically setting up the variables. This changeover need not require you to declare data types as variables will still have them attached. However, you can make some radical changes. For instance, you can add a string to an integer, and it won’t result in any programming error.

For example,

Function abx(): array {

Return [ ];


Consider the example shown above. It defines array type of variable. With return type declaration used above, the function will return only the array. You can use this logic for other returns types such as int, float, and bool. Thus, being a weakly typed language, PHP7 can help you enhance the quality of the code.

Handling Fatal Errors:

A slight mistake from your side and your script may get into a fatal error. This is a common problem that every programmer experiences and previous PHP versions used to stop the script without involving the error handler. However, PHP 7 gives a little relief. An exception will be thrown instead of closing the entire script down.

Easy User-land CSPRNG:

It is nothing but an application space present outside the Kernel. Easy User-land CSPRNG can be covered by privilege separation. This API enables you to use PHP 7 with ease. It is reliable and is used to generate cryptographically secure pseudo-random numbers. No doubt, these random data were also present in the earlier versions, but none of them were as secured at this time. The importance of random numbers goes primarily while designing the program for generating frequently changing random passwords.

Introduction of two new operators:

If you’re upgrading to PHP7, then you will get to know about two new operators; Spaceship operator (<=>) or Combined comparison and Null Coalesce Operator. Let’s get to know about these operators in brief.

Spaceship operator (<=>) or Combined comparison

This one has got behavior similar to strcmp() or version_compare(), but the good thing is that all generic PHP values can get utilized through this new operator in combination with usual semantics like <, <=, ==, >=, >, etc. The comparison rules used is same as that of the previous semantics.

This spaceship operator has got simple usage funda. This operator “(expr) <=> (expr)” will fetch you a value ZERO if both operands are of same value. If the left side is greater than the right side, you will get ONE and -ONE for vice versa condition.

To understand about its behavior better, see how it returns results in case of the followings:


Echo 11 <=> 11; //0


Echo 11.5 <=> 12.5; //-1


Echo c <=> b; //1

Use usort() along with this operator to make the ordering easier.

Null Coalesce Operator 

“??” this is the symbol of Null Coalesce operator. If you want to assign a value to nullable or reference type files, this one can be your savior. If the operand is not null, the operator will return you left-hand operand, and if the reverse is the case, you will get right-hand operand in return.

In PHP7, without engaging this operator, if you are trying to assign a nullable value to a non-nullable one, you will get compile time error for sure. However, the use of “??” operator won’t let that happen.

See the below example for more clarity.

Int? a = null; //here a is a nullable value type

Int x = 0; //here a is a non-nullable value type

X = a;

You will get compile time error as below:

Cannot implicitly convert “int”; to “int.” An explicit conversion exists.

Anonymous class:

A new entry to PHP7 is “anonymous classes.” These classes have no name and can be defined simply with a keyword “new class.” The functionality goes in the similar line as that of an object of named class. They have internally generated names so, we need not define them again. They are useful for creating one-off objects.

For example, consider the below one;

Anonymous class_Image

Earlier, for creating a new class, it was required to override a property or method. That was extending the named class. However, with Anonymous class, your job will be easy for creating a simple one-off object.


If you want to encapsulate the items, then Namespace is what you will be looking for in PHP7. It can import a group of classes, functions, and constraints from the same namespace.

See this example below.

Before PHP7, you need to work as below:

Use xyz\abc\class Z

Use xyz\abc\class Y as newcode

After PHP7, you can work as below:

Use xyz\abc\ {class Z, class Y as newcode};

Here, we have highlighted the most important ones. However, there is a long list of the same. There are few technical advantages also. For instance, it is a commonly known fact that Linux is a more favorable playground for PHP rather than Windows and until now, it was running smoothly on 32-bit Windows, but the current version supports 64-bit windows as well. Therefore, with so much of changeovers, PHP7 can be quoted as one of the major release after PHP5 since 2004. Try to keep digging this new platform to gain maximum output with minimum input.

The Essential Database Types for E-Commerce Business

Wednesday, October 5th, 2016

The average e-commerce business owner uses database without his slightest knowledge. More often, ecommerce stores uses database for three main reasons namely;

• Maintenance of product catalogues
• Tracking business transactions
• For non-product related purposes like blog posts

Different database types can be used to address the above needs. While others are more popular than the rest, there are databases that are commonly used by most ecommerce businesses.

1. Relational Databases
The basic description of a relational database is a collection of spreadsheets with each one having a rows and columns of data. The striking difference between this database and common spreadsheets is that the contained data in relational database bear a connection.

Take the simple case of an ecommerce relational database having distinct tables for customers and orders. Ideally, there is a relationship between the orders and the customers such that is order is associated with a particular customer. The relationship is expressed in such a way that the data elements of an order points to a specific customer.

One awesome aspect of relational databases is that it reduces redundancy and thereby intensifying efficiency. For instance, a change in a customer’s information will only require single editing exercises. Take the case of change in email address for instance. You will only need to change the details in one row of the customer table without affecting the orders table. Subsequently all orders related to that customer will automatically be associated with the new email address.

Ideally, relational databases are perfect for contents that are not product related. They are also ideal for transaction processes. This type of database also comes handy when it comes to design of product catalogues, especially when you are handling overwhelming numbers of combinations like sizes and colours. Over the years, they have grown more popular in the ecommerce industry. Some of the most common examples include MySQL, Oracle, and PostgreSQL.

2. API Database
Application Programing Interface (API) is yet another common type of database. It is essential for data retrieval. It enables connections between your ecommerce sites and third party companies through API to allow storage and retrieval of data. This type of database is mostly common in SaaS Platforms including BigCommerce and Shopify. This database allows different merchants to easily connect to the API and modify the functionalities of their individual stores.

This kind of database can be essential in determining some of your products on the high sale list and storing them in a specially designed page; the best sellers’ page. Although it eases ecommerce operations, API comes with its own fair share of limitations. It is only possible to work with the data that the supplier avails on its API. If the supplier doesn’t avail the order data for instance, there is nothing you can perform on that kind of data. That makes you so reliant on the API supplier.

3. Cloud Databases
They are more like hosting processes than database types. Cloud databases haven’t been around for long. Normally, they are hosted on other third party servers. One interesting feature about this database is that it can serve as a perfect combination of individual database types. With it, you can easily integrate independent relational and document databases to form a completely different thing. This makes it ideal for nearly all types of ecommerce data. A notable advantage of this database is that one wouldn’t have to bother with the rising needs of databases especially when there is growth in data due business expansion.

Nevertheless, there are critical risks associated with this type of database. Trust issues might develop, especially when the involved third party is not reliable. It not only possesses the risk of data interference but also loss of business in case the third party doesn’t stay in business for long. Most remote DBA experts therefore recommend a third party service provider of refutable record of accomplishment and unmatchable reliability. A perfect example is the cloud database offered by Amazon Web Services that combines both Relational Database Service and a DynamoDB document database.

4. Document Databases
They are simple to understand and use. The most basic example is a set of files on your computer with each file bearing a unique name and data. For each data, there is an associated name, which is normally known as a key. The key is necessary for retrieval of the associated data. The contained data can be defined in the same way as the computer files. Taking an ecommerce store for example, you can have varied types of data like order, customer, and types of pages.

One amazing aspect of document tables is their flexibility. It gives you the room of defining the type of data depending on your needs. This makes them perfect for product catalogues and non-product contents. However, document databases also have their limitations. For one, modifying such kind of database is not one of the easiest things. Changing the structure of stored data might mean updating all the involved pieces of data. This can be hectic, especially if not planned for. This makes it less preferable for use in ecommerce stores. Typical examples of Document Database include MongoDB, CouchDB and Redis.

Expect a difference
In reality, the databases might not be clearly defined as explained therein. In many cases, the features of one database can be shared by that of another database. Take the example of PostgreSQL, which is a pure relational database that also serves as a document database. In addition, other service providers like Amazon Web Service, which provides a combination of the cloud version of PostgreSQL with enhanced features like web interface and scaling.

Integrating Multiple Databases
To get the most out your ecommerce store, it might be necessary combining different sets of databases. Each database may be used for a different purpose but all work in unison to provide a perfect trading ecommerce platform for both you and your customers. With this you will be able to maximize profits even as you reduce unnecessary work load.

Author info
Sujain Thomas is an experienced IT expert with closer interest in databases. She has served as one of the best remote DBA experts in her field and is currently heading a private consultation firm. Feel free to contact her in case of any questions.

How to Get Database credentials using WP Admin

Friday, July 18th, 2014

So you forgot database credentials?? Need to know your phpmyadmin credentials or database credential?  And you are asking How to Get Database credentials using WP Admin? Don’t worry. Yes !! It is easy if your website runs under WordPress and you have access to wp-admin.

Lets start right ??

Login to WordPress Admin

First of all login to your wp-admin panel. It is really easy if you know the WordPress. If you don’t know how to login to WP Admin just type URL like

In most cases it will take you to admin login screen. If not just check with your technical persons or make sure you know the directory name where the WordPress is actually installed.

After successful login you will be taken to dashboard and it will look something like this

Now lets move on to the real part. !!!

Add All in One WP Security Plugin

Move to Plugins tab under your wp-admin dashboard. Plugins tab will be on the left side.

Now you will be able to see the list of already installed plugins list on your website. Now if you have not installed “C and Firewall” plugin, just click on “Add New” button as shown below.

Now just do a search by typing “all in one wp security and  firewall” and our required plugin will be on the top of the seach results. Just click on install and after install activate it.

Get wp-config.php file

Now that we have installed our required plugin !! You will see a new tab under Dashboard called “WP Security”. Click on that and move to “Settings” option tab. As you see in the below picture you will have some tabs available in this page and just click on “wp-config.php file” and there you will see an option as “Backup wp-config.php file”. Click on that button, it will download your WordPress site’s config file copy.

Oh yes!!! You are almost done. Now just open that downloaded file using any text editor. And you will find a line with your needed credentials!