Category Archives: PHP

Learning Phalcon PHP – My first book

Yesterday, my first book has been published. I hope you will find it useful. Thank you all for your support ! Check it here

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

php-apidoc – REST API documentation generator tool for PHP 5.3+

Generate documentation for php REST API based application. No dependency. No framework required. Easy to use. php-apidoc – php rest api documentation tool. https://github.com/calinrada/php-apidoc . Check out the dummy generated file: http://calinrada.github.io/php-apidoc/ | php rest api documentation generator.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Many-to-many relationships – Phalcon

If you are working with Phalcon, you will probably need to establish a many-to-many relationship between models. While i was searching in the official documentation, this was not very clear for me at that time. I posted this question on the form, and i got the correct answer. I will explain you here, step by read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

PHP Credit Card Validator – Class

If you ever need to validate credit card numbers, here is a simple validator class. Of course you can use it as simple as just defining validation rules in one array and use the php biult-in preg_match function to validate. But for the sake of good OOP practice, we need a class . Well, i read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

PHP Email Validator

The most common validator – email address validator: <?php $email = "[email protected]"; $pattern = "/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i"; $isValid = preg_match($pattern, $email); ?> Create a simple validation function, so you can use it as many times you need: <?php function validateEmail($email) { $pattern = "/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i"; return preg_match($pattern, $email); } ?> You can check more examples at http://php.net/manual/en/function.preg-match.php .

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Convert multidimensional array to object – PHP

As you may already know, you can convert an array into an object simple like this: <?php $array = array(‘first_name’ => ‘John’, ‘last_name’ => ‘Doe’); $object = (object) $array; ?> Then you call the object: <?php echo $object->first_name; ?> The problem is that you can’t do this with multidimensional array. So, for this, i’ve found read more »

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS