Giter VIP home page Giter VIP logo

php-lab's Introduction

GH language GH release GH license GH stars Node CI Visitors

๐Ÿ”ฌ TangoMan PHP Lab

#back-end #interview #practice #php #technical-interview #test #training #vanilla

๐Ÿ”ฌ TangoMan PHP Lab is a PHP coding project for practicing common interview questions and coding challenges.

There are various PHP scripts in the root directory that implement different algorithms and solutions to coding problems:

  1. ๐Ÿ”„ Ackermann

Implements the Ackermann function, which is a classic example of a recursive function that can be used to test compilers and illustrate the concept of recursion.

  1. ๐Ÿ” BinarySearch

Implements binary search to find an element in a sorted array. Binary search is an efficient algorithm for searching sorted data sets and relies on the divide-and-conquer technique.

  1. โž• Factorial

Calculates factorials recursively. Factorials are used in combinatorics and provide good examples of recursive functions.

  1. ๐Ÿ”ข Fibonacci

Generates Fibonacci numbers recursively. The Fibonacci sequence illustrates recursion and has applications in mathematics and nature.

  1. ๐Ÿ’ฌ FizzBuzz

Prints numbers 1 to 100, but prints "Fizz" for multiples of 3, "Buzz" for multiples of 5, and "FizzBuzz" for multiples of both. This is a common interview screening question.

  1. ๐Ÿ‘‹ HelloWorld

Prints "Hello world!" - the traditional first program for beginner programmers.

  1. โ„๏ธ MinTemperature

Finds minimum temperature value from temperature data. Demonstrates algorithms for finding minimum/maximum values.

  1. ๐Ÿ”„ Palindrome

Checks if a string is a palindrome. Palindromes illustrate recursion and string manipulation.

  1. โœ”๏ธ Perfect

Checks if a number is a perfect number, where the number equals the sum of its divisors. Interesting math and recursion example.

  1. ๐Ÿƒ Poker

Evaluates poker hands. Involves evaluating combinations and ranks of cards.

  1. ๐Ÿฅ‡ PrimeNumbers

Checks if a number is prime, where a natural number greater than 1 has no positive divisors other than 1 and itself.

  1. ๐Ÿ”„ Rot13

Encodes/decodes a string using the ROT13 cipher, a simple letter substitution cipher. Basic encryption example.

  1. ๐Ÿ”‘ SimpleJWT

Implements JSON Web Token (JWT) encoding and decoding.

  1. ๐Ÿ’น Stocks

Return an array holding the names of the top three stocks with the best average performance given two separate arrays containing stocks names and prices.

  1. ๐Ÿ”ข Syracuse

Implements the Syracuse algorithm/sequence. Interesting recursion and number theory example.

  1. ๐Ÿ—๏ธ TowerOfHanoi

Implements the Tower of Hanoi algorithm. A classic algorithm that illustrates recursion and dynamic programming.

  1. ๐Ÿ”„ VonNeumann

Generates Von Neumann ordinal numbers. Illustrates generating recursive sequences.

โœ… Unit Tests

The tests directory in each folder contains PHPUnit test cases for testing the implementations of each algorithm.

๐Ÿš€ Github Actions

This project uses Github Actions for continuous integration and testing. The .github/workflows directory contains YAML workflow definitions for:

  • Linting: Runs php-cs-fixer to check code style and quality on every push and pull request.
  • Testing: Runs the PHUnit tests.

The workflows help maintain code quality and ensure the tests pass on multiple php versions.

๐Ÿ“‘ Documentation

PHPUnit documentation is available here: https://docs.phpunit.de

php-cs-fixer documentation is available here: https://cs.symfony.com/doc/rules/index.html

๐ŸŒŸ Inspiration

The following YouTube videos inspired TangoMan PHP Lab project:

๐Ÿ’ป Dependencies

TangoMan PHP Lab requires the following dependencies:

  • PHP
  • Composer

๐Ÿ˜ PHP

Learn how to install PHP from official documentation here

๐Ÿง Install PHP (Linux)

On linux machine enter following commands

$ sudo add-apt-repository --assume-yes ppa:ondrej/php
$ sudo apt-get update
$ sudo apt-get install --assume-yes php8.2

๐Ÿ“ฆ Composer

Learn how to install Composer from official documentation here

๐Ÿง Install Composer (Linux)

On linux machine install composer globally with the following commands (requires php):

# download binary
$ php -r "copy('https://getcomposer.org/composer-stable.phar', 'composer.phar');"
# install composer globally
$ sudo mv composer.phar /usr/local/bin/composer
# fix permissions
$ sudo chmod uga+x /usr/local/bin/composer
$ sync
# install symfony flex globally to speed up download of composer packages (parallelized prefetching)
$ composer global require 'symfony/flex' --prefer-dist --no-progress --no-suggest --classmap-authoritative
$ composer clear-cache

๐Ÿš€ Installation

โšก Step 1: Simply enter following command in your terminal

sh entrypoint.sh install

๐Ÿ”ฅ Usage

Run sh entrypoint.sh to print help

Run tests:

sh entrypoint.sh unit

Lint code:

sh entrypoint.sh lint

Fix lint errors:

sh entrypoint.sh lint --fix

Uninstall:

sh entrypoint.sh uninstall

๐Ÿค Contributing

Thank you for your interest in contributing to TangoMan PHP Lab.

Please review the code of conduct and contribution guidelines before starting to work on any features.

If you want to open an issue, please check first if it was not reported already before creating a new one.

๐Ÿ“œ License

Copyrights (c) 2024 "Matthias Morin" <[email protected]>

License Distributed under the MIT license.

If you like TangoMan PHP Lab please star, follow or tweet about it:

GitHub stars GitHub followers Twitter

... And check my other cool projects.

php-lab's People

Contributors

tangoman75 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.