Skip to content

Instantly share code, notes, and snippets.

@esthezia
esthezia / cnp-validation.php
Created October 19, 2021 13:29
cnp-validation
<?php
function isCnpValid (string $cnp) : bool {
if (empty($cnp) || (preg_match('/^[1-9]{1}[0-9]{12}$/', $cnp) !== 1)) {
return false;
}
$birthMonth = (int) ($cnp[3] . $cnp[4]);
if (!$birthMonth || ($birthMonth > 12)) {
@esthezia
esthezia / accessible-tabs-jquery-minimal-setup.html
Last active March 7, 2016 10:33
Accessible Tabs (jQuery) - Minimal setup
<!DOCTYPE html>
<html lang="en" class="nojs">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>jQuery - Accessible Tabs</title>
<meta name="description" content="" />
@esthezia
esthezia / php-sanitize-multidimensional-array.php
Created June 18, 2013 11:01
PHP - Sanitize a multidimensional array
<?php
/**
* Sanitize a multidimensional array
*
* @uses htmlspecialchars
*
* @param (array)
* @return (array) the sanitized array
*/