Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
bighardperson avatar

PHP

  • 8 installs
  • 33 repo stars
  • Updated April 26, 2026
  • bighardperson/computer-science-skills-collection

PHP is a skill that provides coding guidelines to write solid PHP while avoiding type-juggling traps, array quirks, and security pitfalls.

About

PHP is a coding-guidelines skill that helps write solid PHP by avoiding type-juggling traps, array quirks, and common security pitfalls. It provides critical rules on strict comparison, prepared statements, and output escaping, plus topic files on types, arrays, OOP, strings, errors, security, and modern PHP 8+ features. A developer references it while writing or reviewing PHP code.

  • PHP coding rules for type juggling, arrays, OOP, and strings
  • Flags common security pitfalls: SQL injection, XSS, CSRF
  • Covers PHP 8+ features like attributes, named args, and match

PHP by the numbers

  • 8 all-time installs (skills.sh)
  • Ranked #52 of 65 PHP & Laravel skills by installs in the Skillselion catalog
  • Data as of Jul 30, 2026 (Skillselion catalog sync)
At a glance

PHP capabilities & compatibility

Capabilities
code review · secure coding · refactoring
Use cases
code review · refactoring · security audit
Platforms
Linux · macOS · Windows
From the docs

What PHP says it does

Write solid PHP avoiding type juggling traps, array quirks, and common security pitfalls.
SKILL.md
Never concatenate SQL — use prepared statements with PDO
SKILL.md
npx skills add https://github.com/bighardperson/computer-science-skills-collection --skill php

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs8
repo stars33
Last updatedApril 26, 2026
Repositorybighardperson/computer-science-skills-collection

What it does

Reference PHP best practices to avoid type-juggling, array, and security pitfalls while coding.

Who is it for?

Writing or reviewing PHP with correct comparisons and safe SQL and output handling

Skip if: Framework-specific Laravel scaffolding beyond core PHP guidance

When should I use this skill?

Writing, reviewing, or refactoring PHP code

What you get

PHP that uses strict comparison, prepared statements, and escaped output.

  • PHP coding rules
  • security guidance

By the numbers

  • 7 topic reference files
  • 14 critical rules listed

Files

SKILL.mdMarkdownGitHub ↗

Quick Reference

TopicFile
Loose typing, ==, ===, type juggling, strict_typestypes.md
Associative arrays, iteration, array functionsarrays.md
Traits, interfaces, visibility, late static bindingoop.md
Encoding, interpolation, heredoc, regexstrings.md
Exceptions, error handling, @ operatorerrors.md
SQL injection, XSS, CSRF, input validationsecurity.md
PHP 8+ features, attributes, named args, matchmodern.md

Critical Rules

  • == coerces types: "0" == false is true — always use === for strict comparison
  • in_array($val, $arr) uses loose comparison — pass true as third param for strict
  • strpos() returns 0 for match at start — use === false not !strpos()
  • Never concatenate SQL — use prepared statements with PDO
  • htmlspecialchars($s, ENT_QUOTES) all output — prevents XSS
  • isset() returns false for null — use array_key_exists() to check key exists
  • foreach ($arr as &$val) — unset $val after loop or last ref persists
  • static:: late binding vs self:: early binding — static respects overrides
  • @ suppresses errors — avoid, makes debugging impossible
  • Catch Throwable for both Error and Exception — PHP 7+
  • declare(strict_types=1) per file — enables strict type checking
  • strlen() counts bytes — use mb_strlen() for UTF-8 character count
  • Objects pass by reference-like handle — clone explicitly with clone $obj
  • array_merge() reindexes numeric keys — use + operator to preserve keys

Related skills

FAQ

Why use === instead of == in PHP?

== coerces types, so "0" == false is true; === does strict comparison without coercion.

How does the skill prevent SQL injection?

It says never concatenate SQL and to use prepared statements with PDO.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.