Skip to content

Instantly share code, notes, and snippets.

View arcanisgk's full-sized avatar
🏦
looking for a job

Walter Nuñez arcanisgk

🏦
looking for a job
  • Icaros Net S.A
  • Panamá
View GitHub Profile
@arcanisgk
arcanisgk / quest.md
Last active December 14, 2021 18:00
data relation in a single table with ORM / Annotation

Data relation in a single table with ORM / Annotation

Assuming a courses table like this:

create table courses (
    course_id int primary key,
    course_name char(50)
  );
@arcanisgk
arcanisgk / gist:1ee76878fde51963d51e8d73c4b0b58d
Created October 5, 2021 22:57
¿Cómo acceder a un valor de un array asociativo dentro de otro?
***Primero:***
para lograr esa estructura tu variable debe ser un array antes de iniciar la asignación de datos entonces te falta esto, la declaración:
$Ibex35=[];
También es importante que comprender que la variable `$numeroEmpresa` debe ser inicializada en 1 ya que no me confirmaste en los comentario como es la estructura numérica, en mi ejemplo iría de la empresa #1 a la #35.
entonces yo usaría los siguiente:
<?php
@arcanisgk
arcanisgk / anonymous-class-abuse.php
Last active February 24, 2021 14:51 — forked from requinix/anonymous-class-abuse.php
Global functions with (nearly) totally private shared data
<?php
/*
Can I write global functions in PHP that share data between them, without also making that data
accessible to everyone else?
Global functions have a particular utility that is handy, even in an OOP codebase: it doesn't
require a fully-qualified class name/use statement and when in the root namespace the function will
be automatically resolved from any other namespace automatically (though prepending that slash is
@arcanisgk
arcanisgk / highlight_string_ex.php
Last active February 24, 2021 14:51 — forked from requinix/highlight_string_ex.php
Quick PHP code highlighter
<?php
function highlight_string_ex($string) {
static $COLORS = [
"comment" => "\e[32m%s\e[0m", // green
"constant" => "\e[93m%s\e[0m", // yellow
"function" => "\e[97m%s\e[0m", // white
"keyword" => "\e[94m%s\e[0m", // blue
"magic" => "\e[93m%s\e[0m", // yellow
"string" => "\e[95m%s\e[0m", // magenta
@arcanisgk
arcanisgk / console-example.php
Created February 24, 2021 04:04 — forked from sallar/console-example.php
PHP Colored CLI Output Script.
<?php
// Output screenshot:
// http://cl.ly/NsqF
// -------------------------------------------------------
include_once 'console.php';
// ::log method usage
// -------------------------------------------------------
Console::log('Im Red!', 'red');
@arcanisgk
arcanisgk / php-style-guide.md
Created August 17, 2020 14:29 — forked from ryansechrest/php-style-guide.md
PHP style guide with coding standards and best practices.

PHP Style Guide

All rules and guidelines in this document apply to PHP files unless otherwise noted. References to PHP/HTML files can be interpreted as files that primarily contain HTML, but use PHP for templating purposes.

The keywords "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Most sections are broken up into two parts:

  1. Overview of all rules with a quick example
  2. Each rule called out with examples of do's and don'ts