This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$miservidor = "127.0.0.1"; | |
$miusuario = "root"; | |
$contra = ""; | |
$mibasededatos = "banco"; | |
//create connection | |
$miconexion = new mysqli($miservidor, $miusuario, $contra, $mibasededatos); | |
//check connection | |
if ($miconexion->connect_error) { | |
die("Fallo la conexion revisa tus datos de conexion !!!: " .$miconexion->connect_error); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait saludo | |
{ | |
public function hola() | |
{ | |
echo "Hola Celeste"; | |
} | |
} | |
trait saludo2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ope{ | |
protected $n1; | |
protected $n2; | |
public function __construct($n1, $n2) { | |
$this->n1 = $n1; | |
$this->n2 = $n2; | |
} | |
public function ope() { | |
return $this->n1 - $this->n2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class animal | |
{ | |
public $nombre = "perro"; | |
public function ladrar(){ | |
print " woof"; | |
} | |
} | |
class chihuahua extends animal { | |
public function ladrar(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class animal { | |
function ladra(){ | |
} | |
function cuantoladra($nladra){ | |
$c=1; | |
while ($c <= $nladra) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<?php | |
class Fruta { | |
public $nombre; | |
public $color; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hacercafé($tipo = "capuchino") | |
{ | |
return "Hacer una taza de $tipo,\n"; | |
} | |
echo hacercafé(); | |
echo hacercafé(null); | |
echo hacercafé("espresso"); | |
echo"<br> Celeste Castillo Flores"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$saludo = function($nombre) | |
{ | |
printf("<br>Hola %s\r\n", $nombre); | |
}; | |
$saludo('Mundo'); | |
$saludo('php'); | |
echo"<br>Celeste Castillo Flores" | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function cuadrado($núm) | |
{ | |
return $núm * $núm; | |
} | |
echo cuadrado(4); // imprime '16'. | |
echo "<br>Celeste Castillo Flores "; | |
echo"<br>5J"; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<?php | |
class Fruta { | |
// Properties | |
public $nombre; | |
public $color; | |
// Methods | |
function Escribe_n($nombre) { | |
echo"El nombre de la fruta es $nombre <br>"; |
NewerOlder