background preloader

PHP Variable and Array Tests

PHP Variable and Array Tests

TCPDF - PHP Class for PDF It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website. <div style="font-family:helvetica,arial;font-size:small;padding:0 4px 0 4px;background-color:#FFFFCC;color:#003399;border:1px;border-style:solid;border-width:1px;border-color:orange;"><form action=" method="post"><div><input type="hidden" name="cmd" value="_donations" /><input type="hidden" name="business" value="paypal@tecnick.com" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="item_name" value="Tecnick.com" /><input type="hidden" name="no_note" value="0" /><input type="hidden" name="currency_code" value="GBP" /><input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_SM.gif:NonHostedGuest" /> It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements.

Deciphering Magic Methods in PHP PHP provides a number of 'magic' methods that allow you to do some pretty neat tricks in object oriented programming. These methods, identified by a two underscore prefix (__), function as interceptors that are automatically called when certain conditions are met. Magic methods provide some extremely useful functionality, and this tutorial will demonstrate each method's use. Before We Begin In order to fully understand magic methods, it's helpful to see them in action. If words like "method" and "property" sound alien to you, you might want to read up on this first. Device objects will hold a name, a Battery object, an array of data, and a handle to some external resource. This tutorial assumes you have a basic understanding of object oriented programming. These classes are pretty useless, but they make a good example for each of the magic methods. Constructors & Destructors Constructors and destructors are called when an object is created and destroyed, respectively. __construct() __get()

Top 20+ MySQL Best Practices Database operations often tend to be the main bottleneck for most web applications today. It's not only the DBA's (database administrators) that have to worry about these performance issues. We as programmers need to do our part by structuring tables properly, writing optimized queries and better code. In this article, I'll list some MySQL optimization techniques for programmers. Before we start, be aware that you can find a ton of useful MySQL scripts and utilities on Envato Market. Most MySQL servers have query caching enabled. The main problem is, it is so easy and hidden from the programmer, most of us tend to ignore it. The reason query cache does not work in the first line is the usage of the CURDATE() function. Using the EXPLAIN keyword can give you insight on what MySQL is doing to execute your query. The results of an EXPLAIN query will show you which indexes are being utilized, how the table is being scanned and sorted etc... After adding the index to the group_id field:

9 Tips For Working with MySQL Databases MySQL is one of the most popular relational database management systems (RDBMS) around, with over 6 million installations. It’s a fantastic choice for any new developer, because of its open source nature, wide support and abundance of tutorials available on the subject. Here are some great tips and tools (beside phpMyAdmin) to improve your MySQL coding, and to help you save time. Installing SQL If you’re a newbie to the server side coding arena, don’t worry. Mac only PHP, SQL & Apache Installer Windows, Linux & Mac installer A windows only LAMP installer MySQL Server 5.1 If you just want MySQL server, and like using command line then this might suit you. For info on how to install and work with the MySQL server, check this NetTuts tutorial: Everything You Need to Get Started With MySQL. SQL Tips 1- Optimize your code Imagine if you have 100 records, 10 columns.Your working with a database of your clients details, and need to select their name, phone number and address. SELECT * FROM clients;

Object Oriented PHP Tutorial for Beginners Preamble The hardest thing to learn (and teach btw,) in object oriented PHP is the basics. But once you understand them, the rest will come much, much easier. But don't be discouraged! … 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'. In this tutorial, you will be guided (step-by-step) through the process of building and working with objects using php's built-in OOP capabilities. OOP Videos

Virtual Template - HOME PAGE Как создать печатную версию сайта? | Обучающие видеоуроки по созданию сайтов. Один HTML-код — две версии сайта Интернет повысил доступность информации многократно, но не отменил книги, учебники, газеты. Информация, представленная на бумаге, как и прежде, нужна. Поэтому я вижу смысл в том, чтобы обеспечить обратную связь, т.е. переход сетевых материалов на бумагу. Тем более, что это сделать просто. Правда, ваш сайт долежен удовлетворять условиям: HTML-код ваших страниц свободен от оформительского кода, т.е. внешнее оформление сайт получает с помощью CSS — каскадной таблицы стилей. В таком случае работа по созданию печатной версии не займет у вас более 5 минут. Шаг #1. Ваш сайт уже имеет версию для вывода на экран. Необходимо добавить в эту строчку media="screen". Теперь строчка выглядит так: <link rel="stylesheet" type="text/css" media="screen" href="css/stylе.css" /> Шаг #2. В печатной версии убирается все, что не относится к главному содержанию на странице: блоки с навигацией, картинками, flash, формами для обратной связи и т.д. при помощи display: none.

How to allow users to download files in PHP So, you want to allow your users to download files from your server. Downloading files in php is a simple process.You do not need scores of lines in your code to achieve that.3 steps and you are done. A working example for the same can be seen here. Steps: 1- Specify content type – this will tell the browser which type of file do you wish to send to user’s browser. 2- Specify the name of the file for user and show an open/save dialog box. 3- Read the original file from your server and render it to users browser. Here is the php code: //download.php //content type header('Content-type: text/plain'); //open/save dialog box header('Content-Disposition: attachment; filename="sample.txt"'); //read from server and write to buffer readfile('test.txt'); Yes, thats all. First we specified a content type using the header function.header is used to send http headers to the browser.Content type will be set depending on the file type to be downloaded. ///index.html Click to download Thats all.

TOOLBOX - Php - ZendFramework - Par Martin Il existe depuis quelques années de nouveaux outils pour travailler efficacement avec PHP, Ce sont les frameworks, ou cadriciels. Ils apportent un cadre de travail pour mieux architecturer son code, souvent grâce à MVC, des bibliothèques pour éviter de réinventer le roue, mais surtout de la documentation et une communauté. On est ainsi bien aidé dans notre développement, mais voyons comment utiliser au mieux un framework PHP et plus particulièrement le Zend Framework, puisqu’il fait partie de ceux que je connais le mieux et que j’utilise le plus. Photo de just.Luc depuis Flickr Présentation Le Zend Framework ou ZF est en même temps un framework ou cadriciel et une bibliothèque de classes. Pour plus d’informations sur le Zend Framework, lisez la présentation qu’en fait la communauté française : Présentation du ZF Documentation La documentation du Zend Framework est bien développée, pas toujours complète sur certains sujets, mais une excellente base avec beaucoup d’exemples. Normes

В печать! - Вёрстка ОНИ ВАМ УЖЕ ВСТРЕЧАЛИСЬ: ссылки, говорящие "версия для печати" или что-то подобное. Всякий раз, щелкая по этим ссылкам, вы получаете особый документ, содержащий всё ту же информацию, но с другим расположением элементов и, возможно, другой разметкой. Это значит, что кто-то вручную или автоматически с помощью скрипта взял исходный документ и, сняв с него всё лишнее, создал его копию, более удобную для печати. Может быть подобной работой приходилось заниматься и вам. Решение - таблицы стилей для печати Одной из замечательных особенностей CSS является возможность создания таблиц стилей, ориентированных на разнообразные устройства вывода. Но теперь нам нечего бояться, теперь для создания печатной версии документа нам нужен всего лишь хорошо структурированный документ и таблица стилей для печати! Сегодня вы можете взять любой (X)HTML-документ и подготовить его к печати с помощью стилевой таблиц, не прикасаясь к разметке. Обходим ошибку с плавающими элементами В путь Хорошее начало. "Постойте!"

PHP snippets to interact with Twitter Get number of Twitter followers Have you seen my blog sidebar? I display the number of followers I have in full text. Once you have the function, you can call it as shown below: $nb = get_followers('phpsnippets'); echo "PHP Snippets already have ". » Credit: Get latest Twitter status Using PHP and cURL, it is pretty easy to get the status of a specific user. The function is extremely easy to use: echo get_status('catswhocode'); » Link to update status, without encoding problems Many websites and blogs show you how to create a link to Twitter that will update your status. <a href=" So, where’s the change? A working example can be seen on my company website: Get number of retweets for a specific page Most bloggers are using the Tweetmeme widget to display the number of retweets of their posts. Testing friendship between two users

Quels sont vos astuces et secrets de programmation ? Confiez-nous vos trucs pour gagner du temps ou impressionner les collègues Vous faites du développement depuis des années dans votre langage favori et vous croyez qu'il a fini de vous surprendre ? Pas si sûr, car tous les langages ont des secrets, des fonctionnalités cachées que vous rencontrez un beau jour sur le code d'un collègue, sur un projet open-source ou même par une malheureuse (ou heureuse?) faute de frappe. En PHP par exemple, savez-vous qu'il est possible d'appeler « Echo » avec plusieurs paramètres et faire, en quelque sorte de la concaténation avec une virgule ? Si cette astuce est anecdotique, voir inutile, d'autres peuvent surprendre et s'avérer très utiles, comme ce bout de code, certes un peu extrême pour des raisons de démonstration : Code : Il s'agit en fait de l'utilisation des variables dynamiques, ou les variables des variables, une astuce qui marche aussi (et heureusement) pour les fonctions et méthodes de classes. Toujours en PHP, connaissez-vous la classe standard ? Vous en connaissez certainement dans votre langage de prédilection.

Print Stylesheets From CSS Discuss Printing Web documents and CSS This document describes some of the issues concerning the use of CSS to reformat Web documents for printing (using the media type "print"). We also discuss those aspects that CSS is not able to control or even influence. Two of the most common problems with printing occur when positioning other than static is used (e.g. position: absolute) or when there are floats. Print stylesheets At present, few sites specify print stylesheets. Here are some ideas for what to put in your print stylesheet:- Removing navigation aids such as menus, breadcrumbs and search boxes Suppressing background colours [colors] and background images Changing font (e.g. to a serifed font) Changing text line-height (leading) Exposing link URLs through generated content (advanced browsers only, e.g. A thread in css-d in September 2003 suggested that some users have come to expect the printed version of a page to look exactly the same as what they see on screen.

Related: