Skip to content

Instantly share code, notes, and snippets.

View celestecastillo0's full-sized avatar

celestecastillo0

View GitHub Profile
@celestecastillo0
celestecastillo0 / index.php
Created November 14, 2021 01:46
DAWeb UIII act2
<?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);
@celestecastillo0
celestecastillo0 / index.php
Last active November 4, 2021 17:25
Daweb Act7 Herencia3
<?php
trait saludo
{
public function hola()
{
echo "Hola Celeste";
}
}
trait saludo2
@celestecastillo0
celestecastillo0 / index.php
Created November 4, 2021 13:36
Daweb Act7 Herencia2
<?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;
@celestecastillo0
celestecastillo0 / index.php
Created November 4, 2021 12:03
Daweb Act7 Herencia
<?php
class animal
{
public $nombre = "perro";
public function ladrar(){
print " woof";
}
}
class chihuahua extends animal {
public function ladrar(){
@celestecastillo0
celestecastillo0 / index.php
Created October 28, 2021 20:22
Deweb Act6 UII POO2
<?php
class animal {
function ladra(){
}
function cuantoladra($nladra){
$c=1;
while ($c <= $nladra)
{
@celestecastillo0
celestecastillo0 / index.php
Created October 28, 2021 20:04
Deweb Act6 UII POO
<!DOCTYPE html>
<html>
<body>
<?php
class Fruta {
public $nombre;
public $color;
@celestecastillo0
celestecastillo0 / index.php
Created October 28, 2021 01:29
DeWeb act5 UII ¿parametros
<?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";
?>
@celestecastillo0
celestecastillo0 / index.php
Last active October 28, 2021 01:21
DeWeb act5 UII anonimas
<?php
$saludo = function($nombre)
{
printf("<br>Hola %s\r\n", $nombre);
};
$saludo('Mundo');
$saludo('php');
echo"<br>Celeste Castillo Flores"
?>
@celestecastillo0
celestecastillo0 / index.php
Created October 27, 2021 23:51
DeWeb act5 UII función sin parámetro y retorno
<?php
function cuadrado($núm)
{
return $núm * $núm;
}
echo cuadrado(4); // imprime '16'.
echo "<br>Celeste Castillo Flores ";
echo"<br>5J";
?>
@celestecastillo0
celestecastillo0 / index.php
Created October 25, 2021 14:32
Dwab_UII_poo
<html>
<body>
<?php
class Fruta {
// Properties
public $nombre;
public $color;
// Methods
function Escribe_n($nombre) {
echo"El nombre de la fruta es $nombre <br>";