Tag Archives: array

Remove Repeated Words in String – PHP

php3




Usually we do remove duplicate words from a string using array functions etc, But it’s very slow doing that way because of the size of the string. The fastest way to achieve the same result is PHP regex. You can remove duplicate words using PHP regular expressions with preg_replace. Below is a complete PHP example code using regular expression to remove duplicate words from a string. <?php $text =‘one one, two three, two’; $result_text = preg_replace(“/\b(\w+)\s+\\1\b/i”, “$1″, $text); echo “Result […]

Tweaks to Improve WordPress Posts and Pages

WordPress-Domain-Transfer




We love WordPress – but not all of us are ready to settle with all its default settings and displays – particularly how posts are displayed. As we’re taught that uniqueness does matter to a website’s branding which gives the visitors a great impression, throughout these years bloggers and developers have been striving to tweak the post display, in order to make it as unique as possible. Today we are going to focus on the smart tweaks you can perform […]

Sort Array in PHP

sortarray




If you’ve worked with PHP over any length of time, you’ll already be familiar with arrays — data structures that allow you to store multiple values in a single variable and operate on them as a set. Often, developers find it useful to sort these values, or array elements, into a sequence different from the default one used by PHP. To this end, PHP offers a wide variety of array sorting functions, which allow you to manipulate the arrangement of […]

Smarty PHP Template Engine

smarty_preview




Introduction Smarty is a template engine that allows developers to easily separate their HTML and CSS from their PHP. It also provides added functionality such as date formatting and cycling through values. It’s caching capabilities are extremely flexible and useful in increasing performance and lowering bandwidth usage. From personal experience Smarty can decrease development time up to 40% by greatly reducing the amount of code you must write. It also makes it easier to organize your files and maintain a […]

PHP Arrays and Type

php-array




An array is a data structure that stores one or more similar type of values in a single value. Arrays can be used in many ways to store and organize data quickly and efficiently. It is one of the more useful data types available to any programming language. For example If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this: $cars1="Saab"; $cars2="Volvo"; $cars3="BMW"; However, what if you want […]

Find Current URL with PHP

php3




The full URL to a page comes in three parts: The domain name, the path to the file then the filename, and the query string. For example, take the URL http://www.example.com/example/page.php?name=Bob. The three parts of this are: 1. The domain name: www.example.com 2. The path to the page: /example/page.php 3. The query string: name=Bob So how do you find it all out with your own PHP scripts? All of the information we need is stored in the $_SERVER array, which […]

Jquery Socialist Plugin

socialist




Life can be easy. With the brand-new jQuery plugin Socialist you’re able to aggregate a plethora of streams stemming from different social networks into one, modern and elegant grid-based layout. If you haven’t been living under a stone lately, you’ll have a strong deja vu looking at Socialist’s default output. Yes, you’re right. It does look like Pinterest. If you’re not into Pinterest though, you can have Socialist display the various streams in plain old-school list view. Socialist: Just Add […]

Top 5 Ways to Optimize You PHP code

php-tuneup




PHP is undoubtedly one of the preferred development language for Web development. However, when the project is growing bigger and bigger, there is a real need to manage yout PHP codes so that it could run faster and efficiently. To optimize PHP codes, it require your indeep understanding the mechanism of those PHP built in function and coduct testing on it. Here are 5 ways that you can modify to optimize you PHP code performance. 1) Loop Loop are required […]

jQuery 360 Degrees Image Display

jQuery_j360




If you want to display 360 degree images or panorama images for your products on your website then here are top 5 jQuery 360 degree image display sources or pluginswhich are easy to integrate and useful. j360 j360 is a jQuery plugin designed to display 360 view of product using a set of images. Compatibility with iPhone, iPod, iPad, Google Android devices. Mouse view on PC. Tap view on touch screen mobile devices. Ajax Zoom AJAX-ZOOM is a powerful image […]

Compress JSON data

json1




JSON is good data format to grab some server side data through an AJAX call. For example by using jQuery.ajax method. In PHP, to provide data in JSON format in super simple. However, when the data is large, do you know any ways to compress the data to facilitate for fast transmission. JSON – JavaScript Object Notation Here is a simple tutorial to introduce how to use format data in JSON format in PHP. First, you need to set the […]