άλλο
    PHP - $_SERVER
    $_SERVER $_SERVER is a PHP super global variable which holds information about headers, paths, and script locations. The example below shows how to use some of the elements in $_SERVER: ExampleGet your own PHP Server echo $_SERVER['PHP_SELF']; echo $_SERVER['SERVER_NAME']; echo $_SERVER['HTTP_HOST']; echo $_SERVER['HTTP_REFERER']; echo $_SERVER['HTTP_USER_AGENT']; echo $_SERVER['SCRIPT_NAME']; Try it Yourself » The following table lists the most important...
    από PHP Tutorial 2024-05-17 08:08:50 0 4χλμ.
    άλλο
    PHP $GLOBALS
    $GLOBALS is an array that contains all global variables. Global Variables Global variables are variables that can be accessed from any scope. Variables of the outer most scope are automatically global variables, and can be used by any scope, e.g. inside a function. To use a global variable inside a function you have to either define them as global with the global keyword, or refer to them by using the $GLOBALS syntax. ExampleGet your own PHP Server Refer to...
    από PHP Tutorial 2024-05-17 08:08:27 0 4χλμ.
    άλλο
    PHP Global Variables - Superglobals
    Superglobals were introduced in PHP 4.1.0, and are built-in variables that are always available in all scopes. PHP Global Variables - Superglobals Some predefined variables in PHP are "superglobals", which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special. The PHP superglobal variables are: $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION The...
    από PHP Tutorial 2024-05-17 08:08:10 0 3χλμ.
    άλλο
    PHP Array Functions
    PHP Array Functions PHP has a set of built-in functions that you can use on arrays. Function Description array() Creates an array array_change_key_case() Changes all keys in an array to lowercase or uppercase array_chunk() Splits an array into chunks of arrays array_column() Returns the values from a single column in the input array array_combine() Creates an array by using the elements from one "keys" array and one "values" array...
    από PHP Tutorial 2024-05-17 08:07:42 1 4χλμ.
    άλλο
    PHP Multidimensional Arrays
    In the previous pages, we have described arrays that are a single list of key/value pairs. However, sometimes you want to store values with more than one key. For this, we have multidimensional arrays. PHP - Multidimensional Arrays A multidimensional array is an array containing one or more arrays. PHP supports multidimensional arrays that are two, three, four, five, or more levels deep. However, arrays more than three levels deep are hard to manage for most people. The dimension of...
    από PHP Tutorial 2024-05-17 08:07:20 0 3χλμ.
    άλλο
    PHP Sorting Arrays
    The elements in an array can be sorted in alphabetical or numerical order, descending or ascending. PHP - Sort Functions For Arrays In this chapter, we will go through the following PHP array sort functions: sort() - sort arrays in ascending order rsort() - sort arrays in descending order asort() - sort associative arrays in ascending order, according to the value ksort() - sort associative arrays in ascending order, according to the key arsort() - sort...
    από PHP Tutorial 2024-05-17 08:06:46 0 3χλμ.
    άλλο
    PHP Delete Array Items
    Remove Array Item To remove an existing item from an array, you can use the array_splice() function. With the array_splice() function you specify the index (where to start) and how many items you want to delete. ExampleGet your own PHP Server Remove the second item: $cars = array("Volvo", "BMW", "Toyota"); array_splice($cars, 1, 1); Try it Yourself » After the deletion, the array gets reindexed automtically, starting at index 0. Using the unset...
    από PHP Tutorial 2024-05-17 08:06:22 0 3χλμ.
    άλλο
    PHP Add Array Items
    Add Array Item To add items to an existing array, you can use the bracket [] syntax. ExampleGet your own PHP Server Add one more item to the fruits array: $fruits = array("Apple", "Banana", "Cherry"); $fruits[] = "Orange"; Try it Yourself » Associative Arrays To add items to an associative array, or key/value array, use brackets [] for the key, and assign value with the = operator. Example Add one item to the car array:...
    από PHP Tutorial 2024-05-17 08:06:05 0 4χλμ.
    άλλο
    PHP Update Array Items
    Update Array Item To update an existing array item, you can refer to the index number for indexed arrays, and the key name for associative arrays. ExampleGet your own PHP Server Change the second array item from "BMW" to "Ford": $cars = array("Volvo", "BMW", "Toyota"); $cars[1] = "Ford"; Try it Yourself » Note: The first item has index 0. To update items from an associative array, use the key name: Example Update the year to 2024: $cars = array("brand"...
    από PHP Tutorial 2024-05-17 08:02:49 0 3χλμ.
    άλλο
    PHP Access Arrays
    Access Array Item To access an array item, you can refer to the index number for indexed arrays, and the key name for associative arrays. ExampleGet your own PHP Server Access an item by referring to its index number: $cars = array("Volvo", "BMW", "Toyota"); echo $cars[2]; Try it Yourself » Note: The first item has index 0. To access items from an associative array, use the key name: Example Access an item by referring to its key name: $cars =...
    από PHP Tutorial 2024-05-17 08:02:32 0 4χλμ.
    άλλο
    PHP Create Arrays
    Create Array You can create arrays by using the array() function: ExampleGet your own PHP Server $cars = array("Volvo", "BMW", "Toyota"); Try it Yourself » You can also use a shorter syntax by using the [] brackets: Example $cars = ["Volvo", "BMW", "Toyota"]; Try it Yourself » Multiple Lines Line breaks are not important, so an array declaration can span multiple lines: Example $cars = [ "Volvo", "BMW", "Toyota" ]; Try it...
    από PHP Tutorial 2024-05-17 08:01:55 0 3χλμ.
    άλλο
    PHP Associative Arrays
    PHP Associative Arrays Associative arrays are arrays that use named keys that you assign to them. ExampleGet your own PHP Server $car = array("brand"=>"Ford", "model"=>"Mustang", "year"=>1964); var_dump($car); Try it Yourself » Access Associative Arrays To access an array item you can refer to the key name. Example Display the model of the car: $car = array("brand"=>"Ford", "model"=>"Mustang", "year"=>1964); echo $car["model"]; Try it Yourself...
    από PHP Tutorial 2024-05-17 08:01:14 0 4χλμ.
Blogs
Διαβάζω περισσότερα
άλλο
PHP if Statements
Conditional statements are used to perform different actions based on different conditions....
από PHP Tutorial 2024-05-17 07:45:23 0 2χλμ.
άλλο
PHP Array Functions
PHP Array Functions PHP has a set of built-in functions that you can use on arrays....
από PHP Tutorial 2024-05-17 08:07:42 1 4χλμ.
άλλο
PHP Functions
The real power of PHP comes from its functions. PHP has more than 1000 built-in functions, and...
από PHP Tutorial 2024-05-17 07:53:06 0 2χλμ.
άλλο
PHP Installation
What Do I Need? To start using PHP, you can: Find a web host with PHP and MySQL support...
από PHP Tutorial 2024-05-17 07:09:40 0 2χλμ.
άλλο
PHP - Escape Characters
Escape Character To insert characters that are illegal in a string, use an escape character. An...
από PHP Tutorial 2024-05-17 07:32:36 0 4χλμ.