background preloader

PHP

Facebook Twitter

PHP Optimization Tips. This tutorial will explain many small techniques which will, hopefully, help optimize your php scripts.

PHP Optimization Tips

I considered myself a bit of a PHP pro until I started researching some of this stuff and realized that there is a whole realm of information out there about optimizing php that I didn’t know about. I hope you will be as surprised as I was about some of the things you might learn from this article. Output of Data So first off lets start with outputting data to the user. Here are some handy tips to remeber: echo is faster than print (cite) When outputting strings: Single quotes (’) with concatenation is faster than putting your variables inside a double quote (”) string. Or even better: Use echo’s multiple parameters instead of string concatenation. Loops and Counting Here are some ways to make your loops and counting a bit more efficient. Use pre-calculations and set the maximum value for your for-loops before and not in the loop. When checking the length of strings: When incrementing: And.

Simple User Login. 55 Awesome PHP Tutorials for Noobs. Free PHP Script, Class for AJAX, Database, Upload & Download. PHPExcel - Home. Object Oriented PHP Tutorial for Beginners - KillerPHP.com. Preamble The hardest thing to learn (and teach btw,) in object oriented PHP is the basics.

Object Oriented PHP Tutorial for Beginners - KillerPHP.com

But once you understand them, the rest will come much, much easier. But don't be discouraged! You just found the easiest to understand tutorial out there on OOP and PHP. It may sound like a boastful claim, I know, but that's what the nerd zeitgeist is saying. … Or so I've been told. About This Tutorial This tutorial is designed to teach total beginners object oriented PHP. This is not a long-winded theoretical blathering that you see all too often; instead, we actually start writing OO code very quickly. So before you begin, get out your favorite PHP code editor and be ready to write and run some object oriented PHP code. PS: scroll to the bottom of the page for the supporting videos. Thanks for reading,Stefan Mischook Introduction With the release of php5 in 2004, php programmers finally had the power to code with the 'big boys'. OOP Videos. Easy Ways to Sort Arrays in PHP.

Tutorial by Matt Doyle | Level: Beginner | Published on 16 August 2010 Categories: Learn how to sort arrays quickly and simply in PHP.

Easy Ways to Sort Arrays in PHP

This tutorial shows you how to sort indexed, associative and multidimensional arrays using some handy PHP array functions. As I mentioned in my earlier article, Creating Arrays in PHP, arrays are very useful if you need to store and manipulate a large amount of data in one go. One useful way you can manipulate this data is to sort it in a particular order. PHP gives you a large number of sorting functions that can sort arrays using many different criteria. We won't try to cover every single PHP array-sorting function in this tutorial. Let's get started! Sorting indexed arrays: sort() and rsort() The sort() function sorts the values in an indexed array in ascending order. $myArray = array( 1, 2, 'a', 'b', 'A', 'B' ); sort( $myArray ); // Displays "A B a b 1 2" foreach ( $myArray as $val ) echo "$val "; Sorting associative arrays: asort() and arsort() Summary.

15 PHP regular expressions for web developers. Getting started with regular expressions For many beginners, regular expressions seems to be hard to learn and use.

15 PHP regular expressions for web developers

In fact, they’re far less hard than you may think. Before we dive deep inside regexp with useful and reusable codes, let’s quickly see the basics: Regular expressions syntax PHP regular expression functions Validate domain name Verify if a string is a valid domain name. $url = " if (preg_match('/^(http|https|ftp)://([A-Z0-9][A-Z0-9_-]*(? » Source Enlight a word from a text This very useful regular expression find a specific word in a text, and enlight it.

$text = "Sample sentence from KomunitasWeb, regex has become popular in web programming. Enlight search results in your WordPress blog As I just said that the previous code snippet could be very handy on search results, here is a great way to implement it on a WordPress blog. Echo $title; Now, just before the modified line, add this code: <? Save the search.php file and open style.css. » Source Get all images from a HTML document.