?> <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>opdracht functions</title> </head> <body> <h1>Opdracht functions - deel 1</h1> <p> Som: <?php echo berekenSom(1, 2); ?> </p> <p> Vermenigvuldiging: <?php echo vermenigvuldig(1, 2); ?> </p> <p> Even: <?php echo isEven(25); ?> </p> <p> Uitbreiding: <?php var_dump(uitbreiding("Mijn naam is Ben"));
{ return $getal1 + $getal2; } function vermenigvuldig($getal1, $getal2) { return $getal1 * $getal2; } function isEven($getal) { if ($getal % 2 === 0) { return true; } else { return false; } } $optelling = berekenSom(5, 5); $maal = vermenigvuldig(5, 5); $isheteven = isEven(5); function geefLengteEnUppercase($string) { return array(strtoupper($string), strlen($string)); } $boodschap = geefLengteEnUppercase("schildpad"); ?> <!DOCTYPE html> <html> <head> <title>functions</title> </head> <body> <p><?php
$som = $getal1 + $getal2; return $som; } function berekenVermenigvuldiging($getal1, $getal2) { $vermenigvuldig = $getal1 * $getal2; return $vermenigvuldig; } function isEven($getal) { if ($getal % 2 == 0) { return true; } return false; } $som = berekenSom(4, 5); $product = berekenVermenigvuldiging(4, 5); $getalPariteit = 11; $pariteit = isEven($getalPariteit); ?> <!DOCTYPE html> <html> <head> <title>Oplossing functies: deel1</title> </head> <body> <h1>Oplossing functies: deel1</h1> <p>Som 4, 5 <?php
{ $result = strtoupper($string); return str_split($result); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p><?php echo $getal1 . " + " . $getal2 . " = " . berekenSom($getal1, $getal2); ?> </p> <p><?php echo $getal1 . " * " . $getal2 . " = " . vermenigvuldig($getal1, $getal2); ?> </p> <p><?php echo $getal . " is "; if (isEven($getal)) { echo " even"; } else { echo " oneven"; } ?> </p>
$uitkomst = $getal1 + $getal2; return $uitkomst; } function vermenigvuldig($getal1, $getal2) { $uitkomst = $getal1 * $getal2; return $uitkomst; } function isEven($getal1) { if ($getal1 % 2 > 0) { return false; } return true; } $som = berekenSom(9, 11); $product = vermenigvuldig(9, 11); $evenGetal = 9; $evenheid = isEven($evenGetal); ?> <!DOCTYPE html> <html> <head> <title>Oplossing functies: deel1</title> </head> <body> <h1>Oplossing functies: deel1</h1> <p>9 + 11 = <?php
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>functies1</title> <link rel="stylesheet" type="text/css" href="http://web-backend.local/css/global.css"> <link rel="stylesheet" type="text/css" href="http://web-backend.local/css/directory.css"> <link rel="stylesheet" type="text/css" href="http://web-backend.local/css/facade.css"> </head> <body class="web-backend-inleiding"> <section class="body"> <p><?php echo berekenSom(4, 5); ?> </p> <p><?php echo vermenigvuldig(4, 5); ?> </p> <p><?php echo isEven(7); ?> </p> <p><?php foreach (returnStringArray('Dit is een hele gewone string.') as $value) { ?> <?php
function isEven($getal) { if ($getal % 2 == 0) { return true; } else { return false; } } function lengthStringAndUpperCase($string) { $length = strlen($string); $uppercase = strtoupper($string); $arrayToReturn = array($uppercase, $length); return $arrayToReturn; } $som = berekenSom(5, 4); $vermenigvuldeging = vermenigvuldig(5, 4); $getalToCheck = 13; $isGetalEven = ""; $stringToUpperAndCount = "sepperenty"; $stringToUpperAndLength = lengthStringAndUpperCase($stringToUpperAndCount); if (isEven($getalToCheck)) { $isGetalEven = "het getal " . $getalToCheck . " is even"; } else { $isGetalEven = "het getal " . $getalToCheck . " is oneven"; } ?>
?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Oplossing Functions : Deel 1</title> <link rel="stylesheet" href="http://web-backend.local/css/global.css"> <link rel="stylesheet" href="http://web-backend.local/css/facade.css"> <link rel="stylesheet" href="http://web-backend.local/css/directory.css"> </head> <body> <p> <?php echo "De som van 4+5 = " . berekenSom(4, 5); ?> </p> <p> <?php echo "het product van 4x5 = " . vermenigvuldig(4, 5); ?> </p> <p> het getal 4 is <?php echo iseven(4) ? "even" : "oneven"; ?> </p> </body> </html>
<title>Opdracht functies</title> <link rel="stylesheet" href="http://web-backend.local/css/global.css"> <link rel="stylesheet" href="http://web-backend.local/css/facade.css"> <link rel="stylesheet" href="http://web-backend.local/css/directory.css"> </head> <body class="web-backend-opdracht"> <section class="body"> <h1>Opdracht functies: deel 1</h1> <ul> <li>Maak een functie <code>berekenSom</code> die 2 parameters heeft, <code>$getal1</code> en <code>$getal2</code></li> <li> Som = <?php echo berekenSom(2, 5); ?> </li> <li>Maak een functie <code>vermenigvuldig</code> die 2 parameters heeft, <code>$getal1</code> en <code>$getal2</code></li> <li>Vermenigvuldiging = <?php echo vermenigvuldig(2, 5); ?> </li> <li>Maak een functie <code>isEven</code> met 1 parameter <code>$getal</code> <li>Number 5 is even? <?php echo printf(isEven(5)); ?> </li>
function lengthAndUpper($string) { $arrResult['1'] = strlen($string); $arrResult['2'] = strtoupper($string); return $arrResult; } ?> <!DOCTYPE html> <head> <meta charset="utf-8"> </head> <body> <p><?php echo berekenSom(1, 3); ?> </p> <p><?php echo vermenigvuldig(2, 3); ?> </p> <p><?php echo isEven(54875); ?> </p> <pre><?php print_r(lengthAndUpper("hello world")); ?> </pre>
<html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>for</title> </head> <body> <h1>functions</h1> <?php echo "Cijfers zijn 2 & 7"; ?> <br><br> <?php echo "Som = " . berekenSom(2, 7); ?> <br> <?php echo "Product = " . vermenigvuldig(2, 7); ?> <br> Is 5 even? --> <?php echo isEven(5) ? "true" : "false"; ?> <p> Uitbreiding: <?php var_dump(uitbreiding("Mijn naam is Adriaan")); ?>
$resultaat = $getal1 * $getal2; return $resultaat; } function isEven($getal) { if ($getal % 2 == 0) { return "true"; } else { return "false"; } } ?> <!DOCTYPE html> <html> <p> <?php echo berekenSom(5, 3); ?> </p> <p> <?php echo vermenigvuldig(5, 3); ?> </p> <p> <?php echo isEven(8); ?> </p> </html>
} else { return true; } } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>oplossing deel1 fucnties</title> </head> <body> <p> 1+1 = <?php $uitkomst = berekenSom(1, 1); echo "{$uitkomst}"; ?> </p> <p> 6*6 = <?php $uitkomst = vermenigvuldig(6, 6); echo "{$uitkomst}"; ?> </p> <p> het getal 5 is <?php if (isEven(5)) { echo "wel "; } else { echo "niet ";
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Deel 1</title> </head> <body> <p><?php echo $getal1; ?> + <?php echo $getal2; ?> = <?php echo berekenSom($getal1, $getal2); ?> </p> <p><?php echo $getal1; ?> * <?php echo $getal2; ?> = <?php echo vermenigvuldig($getal1, $getal2); ?> </p> <p><?php echo $getal1; ?>
function isEven($getal1) { $getal1 % 2 == 0 ? $bool = true : ($bool = false); return $bool; } //*********************************** DEEL 2 ******************************* ?> <!DOCTYPE html> <html> <head></head> <body> <h1>DEEL 1</h1> <p><?php echo berekenSom(4, 7); ?> </p> <p><?php echo berekenProduct(4, 7); ?> </p> <p><?php echo isEven(4); ?> </p> </body> </html>
<?php function berekenSom($getal1, $getal2) { $som = $getal1 + $getal2; return $som; } $optellen = berekenSom(20, 15); function vermenigvuldig($getal1, $getal2) { $som = $getal1 * $getal2; return $som; } $vermenigvuldigen = vermenigvuldig(20, 15); function isEven($getal1) { if ($getal1 % 2 > 0) { return false; } else { return true; } } $even = isEven(8); function Stringtion($string) { $result['upper'] = strtoupper($string); $result['length'] = strlen($string); return $result; } $string = Stringtion('ik leer php'); ?>
$vermenig = vermenigvuldig(10, 6); $getaleven = 11; $iseven = isEven($getaleven); $string = 'Dit is een string'; $upEnLeng = uitbreiding($string); ?> <!DOCTYPE html> <html> <head> <title>Opdracht functies: deel 1</title> </head> <body> <h1>Opdracht functies: deel 1</h1> <p>De som van 10 en 6 = <?php echo berekenSom(10, 6); ?> </p> <p>De vermenigvuldeging van 10 en 6 = <?php echo $vermenig; ?> </p> <?php if ($iseven) { ?> <p>getal <?php echo $getaleven; ?> is even </p> <?php
<?php $testGetal1 = 5; $testGetal2 = 10; $testString = 'alsdkfj'; function berekenSom($getal1, $getal2) { $som = $getal1 + $getal2; return $som; } $berekenSomResult = berekenSom($testGetal1, $testGetal2); function berekenProduct($getal1, $getal2) { $product = $getal1 * $getal2; return $product; } $berekenProductResult = berekenProduct($testGetal1, $testGetal2); function isEven($getal) { if ($getal % 2 === 0) { $result = TRUE; } else { $result = FALSE; $result = (int) $result; } return $result; } $isEvenResult = isEven($testGetal1); function stringToUpperLength($string) { $stringToUpper = strtoupper($string);
<?php function berekenSom($getal1, $getal2) { return $getal1 + $getal2; } $som = berekenSom(5, 5); function vermenigvuldig($getal1, $getal2) { return $getal1 * $getal2; } $keer = vermenigvuldig(5, 5); function isEven($getal1) { if ($getal1 % 2 == 0) { return true; } else { return false; } } $iseven = isEven(4); ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Opdracht-concat</title> </head> <body>
return $getal1 + $getal2; } function vermenigvuldig($getal1, $getal2) { return $getal1 * $getal2; } function isEven($getal1) { if ($getal1 % 2 > 0) { return false; } return true; } $getal1 = 4; $getal2 = 8; $som = berekenSom($getal1, $getal2); $product = vermenigvuldig($getal1, $getal2); $pariteit = isEven($getal1); ?> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Opdracht functies</title> <link rel="stylesheet" href="http://web-backend.local/css/global.css"> <link rel="stylesheet" href="http://web-backend.local/css/facade.css"> <link rel="stylesheet" href="http://web-backend.local/css/directory.css"> </head> <body class="web-backend-opdracht"> <section class="body">