Skip to content

Instantly share code, notes, and snippets.

View devsmt's full-sized avatar

devsmt devsmt

  • freelance developer
  • mantova, IT
View GitHub Profile
@devsmt
devsmt / gist:7c2de10ada36b0e7fd56bd70e1fed625
Last active October 6, 2016 08:01
mysql functions emulation/compatible/polifill for php7
// get a reference of your connections someware
$GLOBALS['__db_link'] = mysqli_connect($__dbaddress,$__login,$__password,$__dbname);
if (mysqli_connect_errno()) {
die(mysqli_connect_error());
}
// php7 emulation
function mysql_query($rs) { return mysqli_query($GLOBALS['__db_link'], $rs); }
function mysql_fetch_assoc($rs) { return mysqli_fetch_assoc($rs); }
function mysql_fetch_array($rs) { return mysqli_fetch_array($rs); }
function mysql_fetch_row($rs) { return mysqli_fetch_row($rs); }
// php7 emulation of apc_* functions
if (!function_exists('apc_fetch')) {
function apc_fetch($key) {
return apcu_fetch($key);
}
function apc_exists($keys) {
return apcu_exists($keys);
}
function apc_delete($key) {
return apcu_delete($key);
@devsmt
devsmt / MiniBlockChain.php
Last active February 22, 2023 16:26
minimalistic blockchain in PHP
#!/usr/bin/env php
<?php
declare (strict_types = 1);
/*
proof of concept of the inner workings of a Block Chain
*/
class BlockChain {
public string $path;
public array $data;
public function __construct(string $path) {