Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2012
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    PHP vs Python and Ruby

    Hello,
    In recently time, I more and more listen, that Ruby or Python are bests languages that PHP.
    I interested this is correctly? If yes, to tell least one example.
    that is:
    "Python (or Ruby) can "something", but php cann't this, so, php is worse!"
    Please tell this "something".

  • #2
    New to the CF scene
    Join Date
    May 2012
    Posts
    7
    Thanks
    0
    Thanked 1 Time in 1 Post
    It is difficult to defi ne what readability and usability means to programming
    language users. PHP follows a very classical approach, is extensively documented
    and will probably be the most familiar to former C-programmers. Python with
    its strict indentation enforcements and the small set of keywords will probably
    be the best choice for programming beginners. Finally Ruby will probably be
    attractive for Smalltalk-enthusiasts and experienced programmers, that look for
    elegant and powerful programming expressiveness.
    While Python seems to have the most readable syntax of the three languages
    (because of the enforced program strucuture), Ruby seems to be the most usable
    one (because of its principle of least surprise). Of course PHP is a readable
    language too, because most programmers are familiar with C-based syntax.




    Ruby is a language that has only one major web framework in the market: Ruby
    on Rails. It makes use of CGI as gateway but also provides its own web server,
    which is recommended for development and testing only. I will skip a hello world
    example here and continue with listing 1.6, the check login function in Ruby.
    Listing 1.6. Checking login data in a Ruby
    r e q u i r e ' d i g e s t /md5 '
    def che c k l o g in ( username , password )
    hash = Dige s t : :MD5. hexdi g e s t ( "#fpasswordg" )
    username = db . e s c a p e s t r i n g ( "#fusername g" )
    r e s = db . query ( "
    s e l e c t u s e r i d from us e r s
    where username = ' " + username +" '
    and password = ' " + password +" ' ; " )
    row = r e s . f e t ch r ow
    unless row . ni l ?
    return row





    Cloud Redundancy

  • Users who have thanked cloudcw for this post:

    dadli88 (05-30-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •