Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_063023.php
Created August 8, 2020 21:24
[ Posted by CPR's Fiddle ] Just some fun, basic, PHP assessment exercises
<?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.
*
@phpfiddle
phpfiddle / fiddle_016838.php
Created July 22, 2020 13:02
[ Posted by ARUN AK ] Links update in a give text.
<?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])) {
@phpfiddle
phpfiddle / fiddle_066714.php
Created July 5, 2020 08:59
[ Posted by Mukesh ] THIS IS TEST REPO FOR OOPS CONCEPTS/PRATICE
<?php
function dd($arr){
echo "<pre>";
print_r($arr);
};
Class ParentClass{
public function myFunction(){
return 'hey called from parent';
@phpfiddle
phpfiddle / fiddle_012852.php
Created June 9, 2020 06:08
[ Posted by Arun Thomas ] test area to find proper php candidate
<?php
echo "test";
?>
@phpfiddle
phpfiddle / fiddle_059555.php
Created June 9, 2020 06:07
[ Posted by Arun Thomas ] test code to identify proper candidate
<?php
echo "test";
?>
@phpfiddle
phpfiddle / fiddle_033644.php
Created May 21, 2020 06:12
[ Posted by Abdul Rehman ] this is assognment
<?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>";
@phpfiddle
phpfiddle / fiddle_040750.php
Created May 18, 2020 21:53
[ Posted by Carla Gomez Carranza ] 1062803d/bonif
<?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";
@phpfiddle
phpfiddle / fiddle_017285.php
Created May 15, 2020 02:07
[ Posted by Sana Mehmoo ] code about the fruits array with string paramter
<?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; }
@phpfiddle
phpfiddle / fiddle_018972.php
Created May 8, 2020 12:12
[ Posted by Giulia ] php post class
<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"])){
@phpfiddle
phpfiddle / fiddle_021623.php
Created May 5, 2020 07:03
[ Posted by Lanang ] thread_solution
<?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 {