This file contains 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 | |
/** | |
* This is open book --- Hooray! | |
* No, really - let's not think of this as a test, but just an assessment | |
* and ability for us to gauge some of your thought process, and approach to coding. | |
* | |
* Use whatever resources you'd like, and limit your time. This shouldn't be something | |
* you spend all afternoon on, but maybe 10-15 minutes per exercise. | |
* |
This file contains 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 | |
$string = "Hallo Studenten http://google.com/your/subpage and https://www.yahoo.com/my/subpage"; | |
$regexp = "/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i"; | |
$anchorMarkup = "<a href=\"%s://%s\" target=\"_blank\" >%s</a>"; | |
preg_match_all($regexp, $string, $matches, \PREG_SET_ORDER); | |
echo '<pre>';print_r($matches);echo '</pre>'; | |
foreach ($matches as $match) { | |
if (empty($match[1]) && empty($match[7])) { |
This file contains 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 dd($arr){ | |
echo "<pre>"; | |
print_r($arr); | |
}; | |
Class ParentClass{ | |
public function myFunction(){ | |
return 'hey called from parent'; |
This file contains 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 "test"; | |
?> |
This file contains 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 "test"; | |
?> |
This file contains 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 | |
//simple array | |
$fruits=["orange","apple","grapes","banana",12,65,45]; | |
echo " before Sorting <pre>"; | |
print_r ($fruits); | |
echo "</pre>"; | |
sort($fruits); | |
echo " after Sorting <pre>"; |
This file contains 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 | |
/*8.El gobierno ha implementado como parte de su programa social un subsidio familiar bajo la siguiente reglamentación. Datos en variables el nombre y apellido del trabajador el sueldo y número de hijos | |
Las familias que tienen de 1 a 2 hijos recibirán S/.70 | |
Las familias que tienen entre 3 y 5 hijos recibirán S/.90 | |
Las familias que tienen 6 hijos a mas recibirán S/.120*/ | |
$nombre= "carla"; | |
$apellido="gomez"; | |
$sueldo="930"; | |
$numhijo="1"; |
This file contains 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 | |
$fruit=array(" Plums","apple","Apricots","mango","Peach","dates","graphes","Litchi","Strawberry","Sweet lime"); | |
arrftn(""); | |
function arrftn($get) | |
{ | |
GLOBAL $fruit; | |
echo "<style> | |
table, th, td { border: 1px solid #06C; } | |
td, th { border: 1px solid #ccc; text-align: center; } | |
th {background: lightblue; border-color: white; } |
This file contains 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> | |
<form name="form1" method="POST" action=""> | |
nome:<input type="text" name="fnome" required><br> | |
sobrenome: <input type="text" name="fsobrenome" required><br> | |
<input name="benvia" type="submit" value="Enviar"> | |
</form> | |
</html> | |
<?php | |
if(isset($_POST["benvia"])){ |
This file contains 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 | |
for($num=1; $num <= 100; $num++) { | |
if($num % 3 == 0 && $num % 5 == 0) { | |
echo "yeah nah <br>"; | |
}elseif($num % 3 == 0) { | |
echo "yeah <br>"; | |
} elseif($num % 5 == 0) { | |
echo "nah <br>"; | |
}else { |