Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_671629.php
Created August 22, 2013 22:28
testing array_diff_key
<?php
$original = array('esfid'=> 'kldjfsdkfjd');
$new = array(
'esfid' => '001GOdemoESFID0',
'opst' => 'won',
'opsfid' => '006c0000002fZvb',
'product' => 'ePm-d30a1',
'quantity' => '4',
'ename' => 'test',
'itemid' => '00kc0000007SdmU',
@phpfiddle
phpfiddle / fiddle_476396.php
Created August 26, 2013 14:55
Demonstrating every 3rd post.
<?php
$array = array(
'red',
'orange',
'blue',
'green',
'yellow',
'purple',
'white',
'black',
@phpfiddle
phpfiddle / fiddle_643973.php
Created August 26, 2013 19:56
loops program
<?php
echo "<p>\n";
$counter=1;
while($counter < 10)
{
echo "abc ";
$counter++;
}
echo"</p>\n";
echo"<p>\n";
@phpfiddle
phpfiddle / fiddle_708133.php
Created August 29, 2013 08:07
nil no description
<?php function get_json_format($results){
//Format and return the result from the given json data
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
@phpfiddle
phpfiddle / fiddle_642665.php
Created August 29, 2013 08:08
no description
<?php
function stripeWords($para)
{
$final_string="";
$value=4;
$words = explode(" ", $para);
foreach( $words as $value ){
if( strlen($final_string . " " . $value) < 4 ){
if( !empty($final_string) ) $final_string .= " ";
$final_string .= $value;
@phpfiddle
phpfiddle / fiddle_989684.php
Created August 29, 2013 09:19
stripara140
<?php
function stripeWords($para){
$text=explode(' ',$para);
foreach($text as $word)
{
$length=strlen($word);
if($length >=4)
{
echo $word;
echo " ";
@phpfiddle
phpfiddle / fiddle_995422.php
Created August 29, 2013 09:22
striparaMCA140
<?php
function stripeWords($para){
$text=explode(' ',$para);
foreach($text as $word)
{
$length=strlen($word);
if($length >=4)
{
echo $word," ";
}
@phpfiddle
phpfiddle / fiddle_455759.php
Created August 29, 2013 09:52
date2dayMCA140
<?php
function getDates($from_date, $to_date){
$i=0;
if(!$from_date || !$to_date ) {return false;}
$dateMonthYearArr = array();
$fromDate = strtotime($from_date);
$toDate = strtotime($to_date);
for ($currentDate = $fromDate; $currentDate <= $toDate; $currentDate += (60 * 60 * 24))
{
@phpfiddle
phpfiddle / fiddle_738466.php
Created August 29, 2013 10:00
daytodayMCA140
<?php
function getDates($from_date, $to_date){
$dates = array();
$step = '+1 day';
$format = 'm/d/Y';
$current = strtotime($from_date);
$to_date = strtotime($to_date);
while( $current <= $to_date ) {
$dates[] = date($format, $current);
$current = strtotime($step, $current);
@phpfiddle
phpfiddle / fiddle_699042.php
Created August 29, 2013 10:14
datetodateMCA140
<?php
function getDates($from_date, $to_date){
$start = strtotime($from_date);
$end = strtotime($to_date);
$days = $end - $start;
$days = ceil($days/86400);
// echo $days;
$n=0;
$weekdays=array("MONDAY","TUESDAY","WEDNESDAY", "THURDAY", "FRIDAY", "SATURDAY","SUNDAY" );
$weekdays1=array("MON","TUE","WED", "THU", "FRI", "SAT","SUN" );