WebWideTutor is a hub for Web design and Web DEV. knowledge sharing

Learn how to create and access PHP multidimensional arrays

multidimensional-array is an array element which can contain another array as a value, which in turn can hold other arrays as well. Each location in the array can hold another array. multidimensional-arrays can be two-dimensional or three-dimensional array. Example, We have this following user’s table, which holds our user’s information, their Usernames, E-mails and Countries of origin. Username E-mail Country Jordan jordan@yahoo.com USA Beckham beckham@gmail.com UK Uhurukenyata uhuru@gv.ke Kenya Now we need to represent our table in array using PHP. Example ⇓ multidimensional-arrays We will first create an array of users, which is two-dimensional.  

Output: – The user … Continue reading Learn how to create and access PHP multidimensional arrays

PHP Anonymous Functions

Anonymous Functions have no given function name unlike normal functions, this is also known as closures. You will mostly use Anonymous Functions in other php functions as parameters, (callback parameters) Some PHP functions use a function as parameter or as callback function to do part of their work. Let us see show cases here the usort() function sorts an array by values using a user-defined comparison function. Forexample, the usort() function takes two parameters , the array to be sorted and a callable $value_compare_func respectively. This second paramter (the user defined comparison function) gives you the possibilitiy to tell the … Continue reading PHP Anonymous Functions

php magic constants

__FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, __TRAIT__ and __NAMESPACE__   PHP Magic Contants : Here are eight magical constants in PHP that change depending on where they are used.Some of these magical constants may provide useful information both within object-oriented programs as well as within procedural programs. The __FILE__ constant is the current filename, __LINE__ is the current line number, __FUNCTION__ is the current function name, __METHOD__ is the current method name (if any), and __CLASS__ is the current class name (if any). Starting with PHP 5.3.0, __DIR__ is the directory that__FILE__ is in and __NAMESPACE__ is the current name‐ space. … Continue reading php magic constants

constants in php

constants in php A constant in PHP is defined or declared by using define() function or by using the const keyword outside a class definition if you are using PHP 5.3.0. or a later version. If you define a constant one time, you can never change it or undefine it again. your constants can only contain boolean, integer, float and string (So called Scalar Data) . Global constants in PHP is assigned through the define() function Example ⇓ Global Constants

Declaring Constants in a Class In Object-oriented Programming PHP there is way to assign constants within a class. Like … Continue reading constants in php

Basics of HTML5

Elements in HTML5 HTML5 comes with  several elements which breaks a single document into multiple small contents that may be either related or independent. These elements add semantic richness to our markup, and make it easier to re-purpose our documents across media and devices.  

How to define HTML5 page structure The Doctyp First, we have the Document Type Declaration, or doctype. This tells our browser  or any other Parser what type of document it’s dealing with. It also detects the specific version of the HTML page.The doctype should be declared before any other writing of HTML in File. … Continue reading Basics of HTML5

php string slice truncate any character in word or in a text

You want to remove the first or last n characters from a string, use substr() The substr() function ist often when you need to slice off the required number of characters from the beginning or end of the string. The substr() function gives you the possibility to slice and dice strings into smaller strings. It accepts three arguments, of which the last is optional: the string to act on, the position to begin slicing at, and the number of characters to return from its start position. A negative value for the third argument tells PHP to remove characters from the end … Continue reading php string slice truncate any character in word or in a text

PHP Change String value behaviour or look

PHP How to Change Strings.Changing and Manipulate Strings in  PHP by using PHP Built-in Functions, strtoupper() ,strtolower()  ,strrev() ,ucfirst(), ucwords() and str_replace() You want to force a string to uppercase, meaning you want to capitalize a string. You can achieve that using the strtoupper() strtoupper function changes every letter of a string to capital letter. Usage: the function takes one string as a parameter input and returns a capitalized string.

Output : ARSENAL IS IN GOOD SHAPE NOW You want to force a string to lowercase, meaning you want to change a string to small letters. You can achieve … Continue reading PHP Change String value behaviour or look

php for web development

What is PHP ? According to the php.net Site “PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. PHP is a server scripting language for creating dynamic Web pages. Taken directyle from the php Site “What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML which is then sent to the client”. The client would receive the results of running that script, but would not know what the underlying code was. You can even configure your web server to process … Continue reading php for web development