Array Count Values

May 29th, 2015

The array_count_values() function returns an array which contains the keys of the original array’s value and the value is the number of occurences. A sample of it’s use is shown below:

$a=array("Mouse","Cat","Dog","Cat");
print_r(array_count_values($a));
?>

Which would give us an output of : Array ( [Mouse]=> 1 [Cat]=> 2 [Dog]=> 1 )

The next functions are used to compare the contents of one array against one or more arrays either returning the key, keys and contents or solely the contents of the specified fields that result from their comparisons. They are array_diff(), array_diff_assoc(), array_diff_key(), array_diff_uassoc() and array_diff_ukey(). all of these are used to determine the difference between a set of arrays returning either the keys or contents to give the results of the said array comparison/s.

Phishing Scmas and others exploit PHP Vulnerabilities

May 22nd, 2015

Security is always the main issue that is more than often over-looked when it comes to developing web-based applications. And with PHP being the most favorable attack platform available on the internet to date, hackers normally rely on the weakness of security that is very much lacking in the many web pages that are being hijacked by hackers for phishing and other malicious attacks to steal information. There is however one issue that everybody must understand, we are all to blame for this beginning with programmers for any program written on any language that is commonly used over the internet is weak if it is not designed and adapted to evolving threats.
This is an issue of responsibility which seems to be lacking greatly in the many development labs who only act on older projects should the clients decide to fund such retro-fitting. The concession is to allow the problems of old be and to focus on new ones, which maybe hoping for these problems to simply fade away into history but as we have found with the many botnets that have been found to be running for years on old derelict computers, they can haunt us with a vengeance.

Further shortening of your code (Part 1)

May 15th, 2015

Many people are using PHP for development and most have truly mastered the art of programming the easy way round. Sadly, many older web sites that used these older styles of programming are not only long but reminiscent of reading something similar to alien writing that is long and incomprehensible to the layman. But good for all of us, there are some people out there who are willing to share their learned ways to those who are just beginning to master the strengths and powers of PHP. The traditional PHP way of checking for Boolean expressions was long and filled with those double equal signs (==)and others that were akin to some other mathematically adept languages but there are simpler ways of doing things as there always is with any language. In the next post we would give and example of the concept.

PHP Programming Tutorials & Tips

May 8th, 2015

One of the more popular technologies for web programming in the recent years owing to its open source technology is the PHP. And it only means that it’s free to use and also compatible with almost any server, say Windows, Linux/Unix and Apache. This technology has many advanced features included in it though its open source.

Extracting More from PHP with the QB Extenstion

May 1st, 2015

QB logoOne of the weaknesses of PHP is that it isn’t doesn’t perform to well when used to develop computationally intensive tasks. Sure, its great for even the most complex of web applications, but is often skipped over in preference of another language for when it comes to computing.

An extension for PHP called QB, remedies this problem “by translating Zend opcodes and executing them through a statically typed virtual machine” resulting in a significant gain in performance even for complex tasks such as pixel-level image manipulation.

If you are new to PHP though, barely understanding the array chunk function, dabbling with PHP+QB is not advised and would be akin to handing your platinum credit card over to a teenager for use; perfect recipe for a disaster. Advanced programmers could benefit from this though it is recommended that you have a pretty fast system once you start compiling since compiling QB from source code is quite memory extensive, requiring at least 2 gigabytes of memory.

Photo Credit

Write secured PHP

April 24th, 2015

Image Source:sitepointstatic.com

PHP programming was written to be an easy language to program. Completely opposite to being very security oriented. It was so until the 4.1 version. Undeniably, Php has grown to be popular in the short term. But it also created many, many, very badly written scripts. And it gave a very big number of programmers a mindset which is not inclined to the security aspect of programming. Maybe, the main reason behind it, is the automation of conversion by PHP of inputted data to script variables using or enabling though php.ini setting register globals. In the 4.1 version of PHP, this type of behavior was left enabled but was not recommended to be used. With PHP 4.2, this type of behaviour was disabled by default. It broke thousands and thousands of scripts worldwide. This dilemma led to forcing the coders to write more secure codes. They made scripts break. This was opposed stongly before but somehow they saw that the move was a smart one.

Using Built-in Functions

April 17th, 2015

espresso PHPYou may be excited about your growing PHP prowess, but why make life more difficult than you have to?

One of the great things about PHP, and other programming languages for that matter, is that it comes with built-in functions. While you can always hard code your way through any problem, using built-in functions will shorten your code and cut the time and effort you need to finish any project significantly. This will give you more time on your hands to engage in other productive activities like checking your FOREX investments or going on a date with your partner.

One easy example where in built-in functions will help you shorten your work is the use of array chunk functions. While you may always convert a string into an array by iterating on string characters, you don’t have to do that at all since there are PHP functions designed to specifically do that for you.

So use built-in functions if you want to be a more efficient programmer.

Photo Credit

PHP Development Tools Released

April 10th, 2015

devtoolsThe PHP community has again gotten a boost with the announcement that Eclipse is set to release their much loved PHP Development tools later this month. The developer tools included in the release is set to again make the lives of PHP developers a whole lot easier and has been since they released the last version (1.0) in 2007. The new release features a new and improved dynamic language toolkit that gives PHP more bite compared to its older counterpart. It is also designed to work with Java so any developed projects can easily be imported into the dynamic language toolkit. Better code testing tools allows faster error checking making development faster and testing is a breeze with better functionality making PHP easier to use and deploy. With this, the PHP community is set to get a boost and life would be a little bit easier in the wild that is the internet where all is supposed to work.

Downsides of Computer programming

April 3rd, 2015

Computer programming is known for its immeasurable contribution to the online community and to the world of technologies. Users are highly dependent to such programming because it caters to several usages that appear to be of great benefit. Taking all those benefits and advantages aside, it is as well important for every user to be aware of the disadvantages that go with computer programming. First downside focuses on the increasing forms of viruses. As we all know, programmers are responsible for varying websites, systems, and programs. These are all products of their effort and definitely took much time to finish but due to prevalent viruses, these works at one instant can be infected and destroyed. Another is that computer programming must always be perfect. This pertains to the need of having completely correct codes and executing the procedure perfectly. This is important because a simple mistake or one missing code can lead to system errors and even breakdown.

Cookies – not the one you dunk in milk

March 27th, 2015

If you have been browsing the web foir quite sometime, then you might have come across cookies which allows your browser to remember passwords and other information that may have anything to do with your actions on a particular website. These can be preferences that would allow the browser or webpage on the browser to determine your habits online allowing it to perform the requested operations faster and easier. A cookie is called a client-based information for it is stored on the client computer (yours when you browse the web) and is taken or stored intact along with all the information it contains for a specified amount of time or till you delete your browsing history and cookies. If you have come across tracking cookies, these are information that defines you to a particular web page which is called upon on your next visit. When creating cookies with your page, there are specific parameters (cookies by the way are created using user-made code in PHP) that must be remembered so as not to fill up the hard disks of your client computers as they visit your website page again and again. The function setcookie is used with the following syntax:

setcookie(var1, var2, time)

The var 1 stands for the name of the cookie you are creating, with the var 2 containing the value of the said cookie and the last parameter is the time which specifies the amount of time it takes for the function to kill (terminate/delete) the cookie. A more defined and elaborate explanation of the function can be found on this <a href=”http://www.php.net/manual/en/function.setcookie.php”>page</aq>.