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"; | |
$usuario="root"; | |
$contra=""; | |
$mibasdatos="bd_izzi"; | |
//create connection | |
$miconexion= new mysqli($miservidor,$usuario,$contra,$mibasdatos); | |
//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 | |
class Perro | |
{ | |
public $nombre = "Rudolf"; | |
public function ladrar(){ | |
print " Guau!"; | |
} | |
} | |
class Bulldog extends Perro { | |
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 operacion{ | |
protected $numero1; | |
protected $numero2; | |
public function __construct($numero1, $numero2) { | |
$this->numero1 = $numero1; | |
$this->numero2 = $numero2; | |
} | |
public function operacion() { | |
return $this->numero1 + $this->numero2; |
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 padre | |
{ | |
public function saluda() { | |
echo "Hola Mundo"; | |
} | |
} | |
class hija extends padre | |
{ | |
public function respondeSaludo() { |
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 Empleado | |
{ | |
public function darsaludo() | |
{ | |
echo "buenos dias" . $this->empleado. "!"; | |
} | |
} | |
$empleados = null; | |
$empleados[] = new Empleado; |
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>"; |
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 | |
echo "Jessica Fong Arredondo<br>"; | |
function chocolate() | |
{ | |
$frase = "Me gusta el chocolate con almendras"; | |
return $frase; | |
} | |
echo chocolate(); | |
?> |
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 | |
echo "Jessica Fong Arredondo<br>"; | |
function chocolate($cantidad,$sabor){ | |
$michocolate = "Tengo $cantidad chocolate(s) y son de $sabor"; | |
echo $michocolate; } | |
$numerochocolate = 2; | |
$saborchocolate = "chocolate con leche y almendra"; | |
chocolate($numerochocolate, $saborchocolate); | |
?> |
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 $chocolate = function(){ | |
echo "Jessica Fong Arredondo <br>"; | |
echo "Me gusta el chocolate"; | |
};echo $chocolate(); | |
?> |
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 | |
echo "la lista de números elegidos son:"; | |
for($i=4; $i<=26; $i=$i+2){ | |
echo "<br>"; | |
echo $i; | |
} | |
echo "Jessica Fong Arredondo"; | |
?> |
NewerOlder