usort() PHP Function Issue with PHP 5.3


pramodhs:

thanks somnath

Originally posted on Somnath Pawar - My Code Book:

Most of you may be faced this issue, usort() behaves differently in PHP 5.1 & 5.3 versions.

E.g

<?php
class myClass {
  public static function mySortMethod($object1, $object2)
  {
     if ($object1->order == $object2->order) 
    {
         return 0;
    }
    return ($object1->order < $object2->order) ? -1 : 1;
  }
}

usort($arr, 'myClass: mySortMethod');

?>

This would be working fine till PHP 5.1, but in latest version means PHP 5.3 it doesn’t sort properly.

Solution:

View original 32 more words

Processing a form with AngularJS + PHP


pramodhs:

thank you for valuable post

Originally posted on Web Development Matters:

If you read my previous blog post about how to make a simple form work with PHP you’re probably thinking: “She just can’t get enough of forms!” and you are right. I can’t.

As soon as I started learning how form validation works in AngularJS I thought I could improve my website’s contact form. If you are considering changing yours too, I’d encourage you to do so.

Why would you change?

If you followed my previous blog post to make your form work, here are some reasons why you should follow this one and change it to AngularJS + PHP instead of simply PHP:

  1. Submitting the form, showing errors, adding error classes, and showing/hiding messages will be done with JavaScript. Before PHP was in charge of all of that. It means that when someone tried to submit a form with invalid fields, the error page would load and the user…

View original 1,314 more words

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: