Skip to content

Instantly share code, notes, and snippets.

@phpfiddle
phpfiddle / fiddle_073837.php
Created April 21, 2017 15:18
[ Posted by Stephanie ] Fetched RSS FEED and prints out its values on Website.
<?php
$url3 = "http://rss.nytimes.com/services/xml/rss/nyt/US.xml"; // xmld.xml contains above data
$feeds3 = file_get_contents($url3);
$rss3 = simplexml_load_string($feeds3);
$items3 = [];
foreach($rss3->channel->item as $entry3) {
$image3 = '';
@phpfiddle
phpfiddle / fiddle_049587.php
Created April 17, 2017 22:51
[ Posted by VanBilt ] Fun with JSON and PHP
<?php
?>
@phpfiddle
phpfiddle / fiddle_083971.php
Created April 16, 2017 08:34
[ Posted by Miguel ] CourseController.php
<?php
namespace BDA\AdminBundle\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use JMS\SecurityExtraBundle\Annotation\Secure;
@phpfiddle
phpfiddle / fiddle_068748.php
Created April 4, 2017 23:19
[ Posted by Silentrunning ] dfgsdfgsdgfsdfgsdfgsdgfsdgsdfgsdfgd
<?php
class Ejemplo{
public $color="";
public $altura=0;
/*public void __set ($nombre, $valor){
switch($nombre){
case "color":
if (preg_match("/^#[0-9A-F]{6}$/",$valor)){
}
$this->color=$valor;
@phpfiddle
phpfiddle / fiddle_056816.php
Created March 31, 2017 14:07
[ Posted by Siddiq ] Put html content between php
<?php
$variable = 'checking';
$variable = <<<HTML
<div class="yui-content" style="overflow-y:auto;height:241px;">
<div class="bodywrapper">
<br/>
<br/>
<div width="100%" class="wizard">
<div>
@phpfiddle
phpfiddle / fiddle_070615.php
Created March 31, 2017 14:00
[ Posted by Siddiq ] To put html content between php code
<?php
$variable = 'checking';
$variable = <<<HTML
<div class="yui-content" style="overflow-y:auto;height:241px;">
<div class="bodywrapper">
<br/>
<br/>
<div width="100%" class="wizard">
<div>
<center><b>Checking output</b></center>
@phpfiddle
phpfiddle / fiddle_074173.php
Created March 25, 2017 18:25
[ Posted by Leonard ] 12345677889
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h2>Tema</h2>
@phpfiddle
phpfiddle / fiddle_014699.php
Created March 25, 2017 03:40
[ Posted by Andrew Elliott ] createProfile
<?php
/*
createProfile -
for http://embed.plnkr.co/WfE5Vt58d792f8dVXbpM/
*/
$id = 7613;
$i = 0;
if (isset($_POST['id']) && is_int((int)$_POST['id'])) {
$i = (int)$_POST['id'];
$id += $i;
@phpfiddle
phpfiddle / fiddle_084335.php
Created March 24, 2017 18:06
[ Posted by Andrew Elliott ] match email2
<?php
/**
Finding an exact match in a text file using PHP AJAX jQuery form
http://stackoverflow.com/questions/15121403/finding-an-exact-match-in-a-text-file-using-php-ajax-jquery-form
*/
if(isset($_POST["email"])){
$email = $_POST['email'];
$emails = <<<emails
@phpfiddle
phpfiddle / fiddle_033029.php
Created March 24, 2017 18:05
[ Posted by Andrew Elliott ] match email
<?php
if(isset($_POST["email"])){
$email = $_POST['email'];
$emails = <<<emails
Bobby Brown bobby@somewhere.com
Guy Slim guy@somewhere.com
Slim Jim slim@somewhere.com
emails;
if (strpos($email,'@')) {
$match = preg_match("/\b{$email}\b/i", $emails );