Archive for: November, 2015

PHP Code snippets

  • November 22, 2015
  • cboursinos
  • php, Tips
  • Comments Off on PHP Code snippets

Hello everyone, i have some small PHP code snippets that you may want to have. Palindrome $string = str_replace( ‘ ‘, ”, $str ); $a = strtolower(preg_replace(“/[^A-Za-z0-9]/”,””,$string)); return $a==strrev($a); Anagrams return(count_chars($a, 1)==count_chars($b, 1)); Fibbonaci return round(pow((sqrt(5)+1)/2, $n) / sqrt(5));

How to Resize images in php

  • November 10, 2015
  • cboursinos
  • php
  • Comments Off on How to Resize images in php

Many websites need to upload images and manipulated them to fit inside they boxes. An easy way to resize images in PHP is the following code, that create images taking as parameter the file name and the width that you want to give to the new image. First of all you need to install php5-gd…