< 1 2 3 4 5 6 7 > >>   Sort: Date

Writing a String to a File with a File Handle in PHP
How To Write a String to a File with a File Handle in PHP? If you have a file handle linked to a file opened for writing, and you want to write a string to the file, you can use the fwrite() function. It will write the string to the file where the file pointer is located, and moves the file pointer ...
2016-11-27, 427👍, 0💬

Using an Array as a Stack in PHP
How To Use an Array as a Stack in PHP? A stack is a simple data structure that manages data elements following the first-in-last-out rule. You use the following two functions together to use an array as a stack: array_push($array, $value) - Pushes a new value to the end of an array. The value will b...
2017-01-11, 418👍, 0💬

Adding Values to an Array without Keys in PHP
Can You Add Values to an Array without Keys in PHP? Can You Add Values to an Array with a Key? The answer is yes and no. The answer is yes, because you can add values without specifying any keys. The answer is no, because PHP will add a default integer key for you if you are not specifying a key. PH...
2017-02-03, 415👍, 0💬

'th' - Adding HTML Table Headers
How To Add Column Headers to a Table? If you want to add column headers to a table, you need to use "th" elements instead of "td" elements in the first row of the table. "th" elements are displayed in bold and centered by default. Below is a tutorial example of adding column headers to a table: <...
2017-05-05, 407👍, 0💬

HTML 'em' Tag/Element
What Is an HTML "em" Tag/Element? An "em" element is an inline element that you can use to specify text with a normal emphasis. Here are basic rules about "em" elements: "em" elements are inline elements. "em" elements can not be used at block level. Contents of "em" elements will be displayed in it...
2017-04-28, 407👍, 0💬

Copying an Array in PHP
Can You Copy an Array in PHP? You can create a new array by copying an existing array using the assignment statement. Note that the new array is not a reference to the old array. If you want a reference variable pointing to the old array, you can use the reference operator "&". Here is a PHP scr...
2017-02-03, 403👍, 0💬

Uploading Files into Database in PHP
How To Upload Files into Database in PHP? To store uploaded files to MySQL database, you can use the normal SELECT statement as shown in the modified processing_uploaded_files.php listed below: <?php $con = mysql_connect("localhost", "", ""); mysql_select_db("fyi"); $error = $_FILES['fyicenter_lo...
2017-02-20, 401👍, 1💬

💬 2017-02-20 Jonas: Thanks for the sample code!

Using an Array as a Queue in PHP
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements following the first-in-first-out rule. You use the following two functions together to use an array as a queue: array_push($array, $value) - Pushes a new value to the end of an array. The value will ...
2017-01-11, 390👍, 0💬

'align' - Horizontal Alignment HTML Tables
How To Control Horizontal Alignment in Table Cells? By default, text in all table cells are aligned to the left horizontally. If you want to control horizontal alignment yourself, you need to use the "align" attribute in a "tr" element or a "td" element: <tr align="left|center|right"> - Set ho...
2017-05-05, 381👍, 0💬

Padding an Array with a Given Value in PHP
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value multiple times to the end or beginning of an array, you can use the array_pad($array, $new_size, $value) function. If the second argument, $new_size, is positive, it will pad to the end of the array. If ...
2017-01-05, 376👍, 0💬

Creating HTML Table Borders
How To Create Table Borders? There are two sets of borders within a table: Outer Borders - Borders that around the outer edges of the table. Inner Borders - Borders between table cells. If you want to create table outer borders and inner borders, you can use the "border" attribute, which offers two ...
2017-05-13, 369👍, 0💬

'cellpadding' - Padding Spaces in HTML Table Cell
How To Control Padding Spaces within a Table Cell? Cell padding spaces are spaces between cell inner borders and cell content. By default, browsers give cell padding spaces of 1 pixel. If you want to control cell padding spaces within a table cell, you need to use the "cellpadding" attribute, which ...
2017-05-13, 368👍, 0💬

'valign' - Vertical Alignment in HTML Table
How To Control Vertical Alignment? By default, text in all table cells are aligned to the top vertically. If you want to control vertical alignment yourself, you need to use the "valign" attribute in a "tr" element or a "td" element: <tr valign="top|middle|bottom"> - Set vertical alignment to ...
2017-05-05, 366👍, 0💬

'width' for HTML Table Widths
How To Control Table Widths? Usually, browsers will calculate the table width based on the content widths of table cells. If you want to control the width of a table, you need to use the "width" attribute, which allows you to set the table width in pixels or percentages of the parent element width. ...
2017-05-05, 364👍, 0💬

HTML 'table' Element Attributes
What Are the Attributes of a "table" Element? A "table" element may have the following commonly used attributes: "summary" - Specifies a text string as the summary of the table. "width" - Specifies the width of the table. "border" - Specifies the border width. "frame" - Specifies how the outer borde...
2017-05-13, 359👍, 0💬

HTML 'code' Tag/Element
What Is an HTML "code" Tag/Element? An "code" element is an inline element that you can use to specify text to be treated as computer code. Here are basic rules about "code" elements: "code" elements are inline elements. "code" elements can not be used at block level. Contents of "code" elements wil...
2017-04-28, 359👍, 0💬

HTML 'del' and 'ins' Tags/Elements
What Are HTML "del" and "ins" Tags/Elements? "del" and "ins" elements are inline elements that you can use to specify text to be treated as deleted text and inserted text respectively. Here are basic rules about "del" and "ins" elements: "del" and "ins" elements are inline elements. "del" and "ins" ...
2017-04-28, 355👍, 0💬

Joining Keys and Values into an Array in PHP
How To Join a List of Keys with a List of Values into an Array in PHP? If you have a list keys and a list of values stored separately in two arrays, you can join them into a single array using the array_combine() function. It will make the values of the first array to be the keys of the resulting ar...
2017-01-11, 352👍, 0💬

Creating an Array with a Sequence in PHP
How To Create an Array with a Sequence of Integers or Characters in PHP? The quickest way to create an array with a sequence of integers or characters is to use the range() function. It returns an array with values starting with the first integer or character, and ending with the second integer or c...
2017-01-05, 350👍, 0💬

Data Types of Array Keys in PHP
What Types of Data Can Be Used as Array Keys in PHP? Two types of data can be used as array keys: string and integer. When a string is used as a key and the string represent an integer, PHP will convert the string into a integer and use it as the key. Here is a PHP script on different types of keys:...
2017-02-03, 349👍, 0💬

Sorting an Array by Keys in PHP
How To Sort an Array by Keys in PHP? Sorting an array by keys can be done by using the ksort() function. It will re-order all pairs of keys and values based on the alphanumeric order of the keys. Here is a PHP script on how to use ksort(): <?php $mixed = array(); $mixed["Zero"] = "PHP"; $mixed[1]...
2017-01-21, 349👍, 0💬

HTML Definition List 'dl' Tag/Element
What Is a "dl" Tag/Element? A "dl" element is block level element that can be used to define a definition list, where items are displayed with leading terms. Here are basic rules about "dl" elements: "dl" elements are block level elements. "dl" elements can not have text contents. An "dl" element mu...
2017-05-29, 346👍, 0💬

Copying Array Values to a List of Variables in PHP
How To Copy Array Values to a List of Variables in PHP? If you want copy all values of an array to a list of variable, you can use the list() construct on the left side of an assignment operator. list() will only take values with integer keys starting from 0. Here is a PHP script on how to use list(...
2017-01-29, 346👍, 0💬

Counting the Number of Values in an Array in PHP
How To Get the Total Number of Values in an Array in PHP? You can get the total number of values in an array by using the count() function. Here is a PHP example script: <?php $array = array("PHP", "Perl", "Java"); print_r("Size 1: ".count($array)."\n"); $array = array(); print_r("Size 2: ".count...
2017-01-29, 342👍, 0💬

< 1 2 3 4 5 6 7 > >>   Sort: Date