0 Commentarios
0 Acciones
4K Views
0 Vista previa
Directorio
Descubre nuevas personas, crear nuevas conexiones y hacer nuevos amigos
-
Please log in to like, share and comment!
-
PHP Multiline CommentsMulti-line Comments Multi-line comments start with /* and end with */. Any text between /* and */ will be ignored. The following example uses a multi-line comment as an explanation: ExampleGet your own PHP Server Multi-line comment as an explanation: /* The next statement will print a welcome message */ echo "Welcome Home!"; Try it Yourself...0 Commentarios 0 Acciones 4K Views 0 Vista previa
-
PHP VariablesVariables are "containers" for storing information. Creating (Declaring) PHP Variables In PHP, a variable starts with the $ sign, followed by the name of the variable: ExampleGet your own PHP Server $x = 5; $y = "John" Try it Yourself » In the example above, the variable $x will hold the value 5, and the variable $y will hold the...0 Commentarios 0 Acciones 5K Views 0 Vista previa
-
PHP Variables ScopePHP Variables Scope In PHP, variables can be declared anywhere in the script. The scope of a variable is the part of the script where the variable can be referenced/used. PHP has three different variable scopes: local global static Global and Local Scope A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function: ExampleGet...0 Commentarios 0 Acciones 7K Views 0 Vista previa
-
PHP echo and print StatementsWith PHP, there are two basic ways to get output: echo and print. In this tutorial we use echo or print in almost every example. So, this chapter contains a little more info about those two output statements. PHP echo and print Statements echo and print are more or less the same. They are both used to output data to the screen. The...0 Commentarios 0 Acciones 6K Views 0 Vista previa
-
PHP Data TypesPHP Data Types Variables can store data of different types, and different data types can do different things. PHP supports the following data types: String Integer Float (floating point numbers - also called double) Boolean Array Object NULL Resource Getting the Data Type You can get the data type of any object by using the var_dump() function. ExampleGet your own...0 Commentarios 0 Acciones 3K Views 0 Vista previa
-
PHP StringsA string is a sequence of characters, like "Hello world!". Strings Strings in PHP are surrounded by either double quotation marks, or single quotation marks. ExampleGet your own PHP Server echo "Hello"; echo 'Hello'; Try it Yourself » Note There is a big difference between double quotes and single quotes in PHP. Double quotes process special characters, single quotes...0 Commentarios 0 Acciones 4K Views 0 Vista previa
-
PHP - Modify StringsPHP has a set of built-in functions that you can use to modify strings. Upper Case ExampleGet your own PHP Server The strtoupper() function returns the string in upper case: $x = "Hello World!"; echo strtoupper($x); Try it Yourself » Lower Case Example The strtolower() function returns the string in lower case: $x = "Hello World!"; echo...0 Commentarios 0 Acciones 6K Views 0 Vista previa
-
PHP - Concatenate StringsString Concatenation To concatenate, or combine, two strings you can use the . operator: ExampleGet your own PHP Server $x = "Hello"; $y = "World"; $z = $x . $y; echo $z; Try it Yourself » The result of the example above is HelloWorld, without a space between the two words. You can add a space character like this: Example $x = "Hello"; $y = "World"; $z =...0 Commentarios 0 Acciones 6K Views 0 Vista previa
-
PHP - Slicing StringsSlicing You can return a range of characters by using the substr() function. Specify the start index and the number of characters you want to return. ExampleGet your own PHP Server Start the slice at index 6 and end the slice 5 positions later: $x = "Hello World!"; echo substr($x, 6, 5); Try it Yourself » Note The first character has index 0. Slice to the...