Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_070752.php
Created February 27, 2019 11:37
[ Posted by Polosaty ] ipayafrica web int
<?php
/*
This is a sample PHP script of how you would ideally integrate with iPay Payments Gateway and also handling the
callback from iPay and doing the IPN check
----------------------------------------------------------------------------------------------------
************(A.) INTEGRATING WITH iPAY ***********************************************
----------------------------------------------------------------------------------------------------
*/
//Data needed by iPay a fair share of it obtained from the user from a form e.g email, number etc...
@phpfiddle
phpfiddle / fiddle_062365.php
Created February 21, 2019 10:08
[ Posted by Jayaraman ] backupbilling refund calculation.
<?php
$amount_paid = 65.50;
$totaldays = date('t',strtotime('15-02-2019'));
$amount_paid_per_day = $amount_paid/$totaldays;
$start_date = date('d',strtotime('15-02-2019'));
$today_date = date('d');
$total_refund_day = $totaldays -($today_date - $start_date);
$total_refund_amount = number_format($amount_paid_per_day*$total_refund_day,2,'.','');
echo $totaldays.'--total days in month specified--'.$amount_paid.' ----- '. $total_refund_day .' ---- '.$total_refund_amount;
@phpfiddle
phpfiddle / fiddle_095797.php
Created February 21, 2019 06:20
[ Posted by Sradha ] This is my first php Fiddle after signup
<?php
echo phpinfo();
?>
@phpfiddle
phpfiddle / fiddle_071068.php
Created February 7, 2019 17:10
[ Posted by Abhishek ] st gist id and description to
<?php
$TOKEN="58b5c79b9ef28083cbf44e198312406f051e393c7206bd90c2c6da";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://meeiot.org/put/$TOKEN/mydata");
curl_setopt($ch, CURLOPT_POST, 1);
$payload = json_encode( array( "jsonkey"=> "json value" ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec($ch);
@phpfiddle
phpfiddle / fiddle_052442.php
Created February 7, 2019 17:03
[ Posted by Abhishek ] meeiot add json object
<?php
$TOKEN="58b5c79b9ef28083cbf44e198312406f051e393c7206bd90c2c6da";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://meeiot.org/put/$TOKEN/mydata");
curl_setopt($ch, CURLOPT_POST, 1);
$payload = json_encode( array( "jsonkey"=> "json value" ) );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $payload );
curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$result = curl_exec($ch);
@phpfiddle
phpfiddle / fiddle_021153.php
Created January 21, 2019 16:05
[ Posted by Chintamani ] FirstPhpCode
<?php
echo "hello";
?>
@phpfiddle
phpfiddle / fiddle_034236.php
Created January 15, 2019 04:41
[ Posted by vijay kumar reddy ] rss checking
<?php
?>
@phpfiddle
phpfiddle / fiddle_070928.php
Created December 24, 2018 07:11
[ Posted by Phpsitescripts@outlook.com ] PHP left rotation of array without the need for shifting or sorting. Doesn&#039;t time out HackerRank left rotation challenge.
<?php
/*
NOTES: If $newa is not pre-filled, the function will fail
because the keys will be added out of numerical order, and also, we can't
use ksort here because the test times out for large input arrays if we
do sorts or shifts of any kind.
i.e. $newa[0] might not be in the first spot of the array for instance.
Pre-filling the $newa array makes sure that the keys are 0-($n-1) in order.
@phpfiddle
phpfiddle / fiddle_043075.php
Created December 3, 2018 10:37
[ Posted by Paul Calcraft ] Test IP address validation.
<?php
function request(){
echo "<h1>requested</h1>";
}
request()
?>
<html id="html">
<button id="btn_click" onclick="request1()">click</button>
</html>
<script type="text/javascript">
@phpfiddle
phpfiddle / fiddle_083125.php
Created December 2, 2018 22:25
[ Posted by Sereja3578 ] Пример функции с неограниченным числом переменных на примере вывода декартова произведения.
<?php
namespace helper;
class ArrayHelper
{
public static function each()
{
$args = func_get_args();
$callback = array_shift($args);