PHP Articles & Tutorials

Which is Better - PHP or Python?

Firstly, define “better”? That’s an incredibly subjective term that depends entirely on what you’re looking for. Do you mean faster? More widely used? Easier? Offers greater employment prospects? Greater availability of frameworks and libraries? I could go on.

PYTHON

What are Python’s strengths?

  • Vast array of built-in and 3rd party libraries/modules specifically for web development and server management (server management applies to web development too).
  • Those 3rd party libraries are well designed, well maintained, easy to install and powerful.
  • Ease of development. If you’ve ever programmed in Python, you know how easy it is.
  • Django is very powerful. It helps replace JavaScript and PHP.
  • [OPINION] Personally, I hate PHP and JavaScript. They’re frustrating to use and both are vulnerability prone. PHP more because of flaws in the language; JavaScript because of flaws in the weird-as-hell specification that lead to poor interpretations of how the JS engine should be implemented.
  • Full... read more

Create a Simple URL Shortener With 10 Lines of PHP

posted on Apr 24, 2021 under Best Hosting
tags: Web Hosting Software Tips PHP

I love to solve problems with tiny, one-off scripts. The fewer lines that I have to write, the better. Recently I had another opportunity to do just that. I needed a way to embed links in PDF documents, the destinations of which I might need to update in the future. Links in PDFs can't be updated without generating and sending the files again, which is time consuming. The links were also long, and it would be difficult to type them manually if the documents are printed.

This problem can be solved nicely with a URL shortener. Such services have been around for a long time, but there are a few problems with them:

    You depend on an external service - when it is down, all your links are down. Even worse - if it goes out of business, so do your links.
    All clicks are being monitored for unknown purposes.
    You usually can't change the destination of a short link.
    Some services allow you to choose a custom slug, but all the good ones have already been taken.

The stage is set for writin... read more