Diferencia entre revisiones de «Plantilla:PHP/OperadoresExpresiones»
De WikiEducator
(→Operadores) |
(→Operadores) |
||
| Línea 31: | Línea 31: | ||
|+ style="color:white;background:blue;"font-size:1.50em;|OPERADORES HABITUALES EN PHP | |+ style="color:white;background:blue;"font-size:1.50em;|OPERADORES HABITUALES EN PHP | ||
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;;"|TIPO DE OPERADOR |
| − | |style=" | + | |style="color:white;background:red;"|Operadores aritméticos |
| − | |style=" | + | |style="color:white;background:red;"|Operadores lógicos |
| − | |style=" | + | |style="color:white;background:red;"|Operadores de comparación |
| − | |style=" | + | |style="color:white;background:red;"|Operadores de auto incremento/decremento |
| − | |style=" | + | |style="color:white;background:red;"|Operadores de string: concatenación |
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;"|OPERADOR |
| − | |style=" | + | |style="color:blue;background:white;"|+ - * / % ** |
| − | |style=" | + | |style="color:blue;background:white;"|AND OR && <nowiki>||</nowiki> ! |
| − | |style=" | + | |style="color:blue;background:white;"|== != << < > <= >= <=> ?? |
| − | |style=" | + | |style="color:blue;background:white;"|++$a $a++ --$a $a-- |
| − | |style=" | + | |style="color:blue;background:white;"|. .= |
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;"|TIPO DE EXPRESIÓN |
| − | |style=" | + | |style="color:white;background:red;"|numérico |
| − | |style=" | + | |style="color:white;background:red;"|booleano |
| − | |style=" | + | |style="color:white;background:red;"|booleano |
| − | |style=" | + | |style="color:white;background:red;"|numérico |
| − | |style=" | + | |style="color:white;background:red;"|string |
|- | |- | ||
|} | |} | ||
| Línea 61: | Línea 61: | ||
|+ style="color:white;background:blue;"font-size:1.50em;|OTROS OPERADORES MENOS HABITUALES | |+ style="color:white;background:blue;"font-size:1.50em;|OTROS OPERADORES MENOS HABITUALES | ||
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;"|TIPO DE OPERADOR |
| − | |style=" | + | |style="color:white;background:red;"|Operadores asignación simple |
| − | |style=" | + | |style="color:white;background:red;"|Operadores asignación compuesta |
| − | |style=" | + | |style="color:white;background:red;"|Operadores asignación por referenica |
| − | |style=" | + | |style="color:white;background:red;"|Operadores bit a bit |
| − | |style=" | + | |style="color:white;background:red;"|Operador de control de errors |
| − | |style=" | + | |style="color:white;background:red;font-size: 1.50em;"|Operador de ejecución |
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;"|OPERADOR |
| − | |style=" | + | |style="color:blue;background:white;"|= |
| − | |style=" | + | |style="color:blue;background:white;"|+= *= -= %= **= .= |
| − | |style=" | + | |style="color:blue;background:white;"|& |
| − | |style=" | + | |style="color:blue;background:white;"|& | ^ ~ << >> |
| − | |style=" | + | |style="color:blue;background:white;"|@ |
| − | |style=" | + | |style="color:blue;background:white;"|`` |
|- | |- | ||
| − | |style=" | + | |style="color:white;background:green;"|TIPO DE EXPRESIÓN |
| − | |style=" | + | |style="color:white;background:red;"|valor asignado |
| − | |style=" | + | |style="color:white;background:red;"|numérico |
| − | |style=" | + | |style="color:white;background:red;"|valor referenciado |
| − | |style=" | + | |style="color:white;background:red;"|numérico |
| − | |style=" | + | |style="color:white;background:red;"|no retorna valor anula comunicación de errores si se pordujeran |
| − | |style=" | + | |style="color:white;background:red;"|resultado del comando ejecutado |
|- | |- | ||
|} | |} | ||
Revisión de 13:12 25 oct 2024
//Declara una variable entera y asigna el valor 4 //Usando el operador unario, incrementa una unidad y compáralo con el valor 5 //Muestra un mensaje mostrando su valor //Compáralo con el valor 4 y decrementa en una unidad , muestra información de que no es igual y muestra el valor //Analiza la salida y prueba deferentes situaciones
|
Operadores con asignación en una misma variable
- Cuando la variable donde asignamos el resultado de la expresión forma parte de la expresión, la podemos simplificar
- Veamos el siguiente ejemplo
$a=$a*5;
- Es igual que hacer
$a*=5;
- Esto lo podemos hacer con cualquiera de los operadores aritméticos


