Skip to content

Instantly share code, notes, and snippets.

<?php
echo "ciao";
<?php
var_dump(Pdo::getAvailableDrivers());
foreach (Pdo::getAvailableDrivers() as $driver => $d) {
try {
echo $dsn = $d . ':dbname=testdb;host=127.0.0.1';
echo PHP_EOL;
$dbh = new PDO($dsn, 'dbuser', 'dbpass');
@cirpo
cirpo / gist:457991
Created June 29, 2010 23:31
fix position of the edit and delete icon in the symfony admin generator
li.sf_admin_action_edit a, li.sf_admin_action_delete a {
padding-left:20px;
padding-top: 3px;
}
<?php
function compare($a, $b){
return $a < $b ? -1 : 1;
}
$array_one = array( 0 => 1234, 1 => 5678, 2 => 7777, 3 => 3333);
$array_two = array( 0 => 9999, 1 => 5678, 2 => 8888, 3 => 1234);
<?php
require '../doctrine2/lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
use Documents\User;
use Documents\Project;
use Documents\Manager;
use Doctrine\Common\ClassLoader,
cirpo@uberalles:~/Sites/test/mongoDoctrineTest$ php test.php
/Users/cirpo/Sites/test/mongoDoctrineTest/pippo/herePHP Warning: class_parents(): Class User does not exist and could not be loaded in /Users/cirpo/Sites/test/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php on line 279
PHP Stack trace:
PHP 1. {main}() /Users/cirpo/Sites/test/mongoDoctrineTest/test.php:0
PHP 2. Doctrine\ODM\MongoDB\DocumentManager->find() /Users/cirpo/Sites/test/mongoDoctrineTest/test.php:48
PHP 3. Doctrine\ODM\MongoDB\DocumentManager->getRepository() /Users/cirpo/Sites/test/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:554
PHP 4. Doctrine\ODM\MongoDB\DocumentManager->getClassMetadata() /Users/cirpo/Sites/test/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:409
PHP 5. Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory->getMetadataFor() /Users/cirpo/Sites/test/mongodb-odm/lib/Doctrine/ODM/MongoDB/DocumentManager.php:240
PHP 6. Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory->_lo
We couldn’t find that file to show.
<?php
/* nella tua action */
public function executeFoo()
{
$this->form = myWonderfulForm($this->getUser());
}
/*nella tua myWonderfulForm*/
lab:
lab1:
name: S.C. Laboratorio Istocompatibilità IBMDR
lab2:
name: S.C. Laboratorio di genetica umana
project:
p1:
title: Analisi dei dati HLA del Registro Italiano di Donatori di Midollo Osseo e dei pazienti
description:
<?php
$file = 'cirpo.jpeg';
$regex = "/\.(?:|jpe?g)\$/i";
preg_match_all($regex, $file, $out, PREG_SET_ORDER);
var_dump($out);