Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_070539.php
Created November 4, 2018 09:23
[ Posted by Mukesh Dak ] test code as hello world in PHP
<?php
echo "Hello World to Mukesh Dak !!!";
?>
@phpfiddle
phpfiddle / fiddle_038149.php
Created October 21, 2018 04:24
[ Posted by Martin ] Word analysing in texts
<?php
$analyze = '';
$punctuations = '.:-,;–_?!';
if (isset($_POST['analyze']) and trim($_POST['analyze']) != '') {
$analyze = $_POST['analyze'];
$analyzed = preg_replace( "/\r|\n/", " ", $analyze );
$len = strlen($analyze);
$pl = strlen($punctuations);
for ($i=0; $i < $pl; $i++) {
$analyzed = str_replace($punctuations[$i], ' ', $analyzed);
@phpfiddle
phpfiddle / fiddle_041495.php
Created October 16, 2018 19:17
[ Posted by Jon ] new theingss ss
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Registration</title>
<style type="text/css" media="screen">
.error { color: red; }
</style>
</head>
<body>
@phpfiddle
phpfiddle / fiddle_041019.php
Created October 16, 2018 08:24
[ Posted by Yurii Shpylovyi ] pair path finder
<?php
class pathfinder{
private static $params = [
'string'=>'a b c d e f g h i j',
'node_pair_counter_max'=> 10
];
private static $nodes_old;
public static $node_pairs;
public static $node_pairs_arrays;
public static $pathes_list;
@phpfiddle
phpfiddle / fiddle_082866.php
Created October 8, 2018 06:16
[ Posted by Rupom ] first_user_code
<?php
function wpajaxusersearch()
{
global $wpdb;
$request = $_REQUEST;
$columns = array('u.user_email','um.meta_value','u.user_url','um.meta_value','um.meta_value');
$all_users_id = $wpdb->get_results("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY $sort ASC");
$sort = "u.user_registered ASC";
$search = $request['search']['value'];
@phpfiddle
phpfiddle / fiddle_010924.php
Created October 5, 2018 15:51
[ Posted by Hraday ] afsdfsdfsdfsfsdfsd
<?php
$number_of_groups = 5; /// Please change the number according to your number of sequence you require
$sum_to = 100;
$groups = array();
$group = 0;
while(array_sum($groups) != $sum_to)
{
@phpfiddle
phpfiddle / fiddle_083716.php
Created October 4, 2018 09:15
[ Posted by Maxmattone ] widget test test test
<?php
session_start();
class WidgetTest{
static public $callbacks = array();
public $text = 0;
public $text2 = 0;
public $counters;
function __construct()
{
$this->counters = array_fill(0,100000,0);
@phpfiddle
phpfiddle / fiddle_042086.php
Created October 4, 2018 09:14
[ Posted by Maxmattone ] widget test
<?php
session_start();
class WidgetTest{
static public $callbacks = array();
public $text = 0;
public $text2 = 0;
public $counters;
function __construct()
{
$this->counters = array_fill(0,100000,0);
@phpfiddle
phpfiddle / fiddle_097235.php
Created September 29, 2018 09:32
[ Posted by Mubin ] PHP Indexed Array Loops
<?php
$fruits = array('apple', 'mango', 'grape', 'orange');
echo 'For Loop Example <br>';
for($i = 0; $i< count($fruits); $i++){
echo ('I am '.$fruits[$i].'.<br>');
}
echo '<hr>';
echo 'Foreach Loop Example <br>';
foreach($fruits as $fruit){
echo ('I am '.$fruit.'.<br>');
@phpfiddle
phpfiddle / fiddle_071746.php
Created September 28, 2018 18:49
[ Posted by Ross__123 ] string reverser
<?php
function my_str_rev($str)
{
$reversed = '';
$strArr = str_split($str);
for (end($strArr); key($strArr)!==null; prev($strArr)){
$reversed .= current($strArr);
}
return $reversed;
}