Azeem Hassni
Azeem Hassni
  • Видео 5
  • Просмотров 39 735
Binary Search Algorithm using PHP
Lets understand binary search using some visuals and code, we are using PHP as the programming language here but you can take concepts and implement them in any programming language, Make sure to check the end of the video you will be amazed how fast binary search is to find a number from an array of 3M elements.
Listing down the topics that are covered in this video.
1. Understanding Binary Search using a visual example
2. Implementing binary search as a PHP function
3. Testing the function with smaller datasets
4. Testing the function with datasets containing 1 million, 2 million and 3 million elements respectively.
#binarysearch #algorithm #php
Просмотров: 438

Видео

Lets Build an IoC Container using PHP
Просмотров 8772 года назад
In this tutorial we are recreating the Laravel 's magical IoC or dependency injection container that automatically creates instances of all the dependencies of a class that is resolved out the IoC container. When you're following the S.O.L.I.D principles in your application you will notice that you have to pass a good number of nested class dependencies to any class, an IoC container can automa...
Create your own PHP Router the simplest possible way - Episode 3 - Named URL Segments
Просмотров 2,6 тыс.3 года назад
In this episode of "Create your own PHP Router the simplest possible way" we are going to continue on the dynamic routes and allow for named URL segments instead of using regular expressions, of course we can still use regular expressions but this makes it so much readable that I couldn't stop myself from making this short video. #PHP #PHPRouter
Create your own PHP Router the simplest possible way - Episode 2 - Dynamic Routes
Просмотров 6 тыс.3 года назад
In this episode we are looking into adding dynamic routes capability and 404 error handling. If you haven't already I'd highly recommend to watch the episode 1 here ruclips.net/video/gVPAboBbGRE/видео.html
Create your own PHP Router the simplest possible way - Episode 1 - The Router
Просмотров 30 тыс.6 лет назад
Github Repo: github.com/azeemhassni/simplest-php-router I used PHP's built-in Web Server in this example but if you are planning to use this with Apache you can use this gist gist.github.com/azeemhassni/e819e014a80bba5c8cf9429d120a45ac to setup your .htaccess

Комментарии

  • @neozes
    @neozes 6 месяцев назад

    Pretty nice lesson. At some point you said you will show when the exceptions are triggered and you didn't do it. So this was a bit of bummer. It is a valuable observation to aid the understanding of the mechanism.

  • @programmingholic
    @programmingholic 11 месяцев назад

    Thanyou so much for sharing, keep sharing your knowledege.

  • @AbdelrahmanMoussaAbuOuf
    @AbdelrahmanMoussaAbuOuf Год назад

    Great explanation Azeem! Thank you

  • @gratisbacanovel
    @gratisbacanovel Год назад

    this is exactly what i need, thank you :)

  • @phpstudy8625
    @phpstudy8625 Год назад

    Super !!!

  • @AtomTCP
    @AtomTCP 2 года назад

    Good job.

  • @muhammadahadaminul9529
    @muhammadahadaminul9529 2 года назад

    Nice ! How to implement controller and controllers method with this route ?

    • @azeemhassni
      @azeemhassni 2 года назад

      You can use controller methods as callbacks as you would use any other class method in php for example, ``` route('/users', [new UserController(), 'index']); ```

  • @trdd1085
    @trdd1085 2 года назад

    great explanation.

  • @Aryan-qw8oq
    @Aryan-qw8oq 2 года назад

    Great video! But why is it not 1200x720?

  • @JavedBaloch786
    @JavedBaloch786 2 года назад

    Great, keep it up Please add a little explaination of time complexity of the algo. Normally binary search's time complexity is O(log n) if array is sorted.

  • @imdadshafi
    @imdadshafi 2 года назад

    Great job bro..

  • @hassanamirkhan
    @hassanamirkhan 2 года назад

    Good work 👍🏻

  • @rizwanellahi9624
    @rizwanellahi9624 2 года назад

    Greate tutorial, even beginner like me understood it easily 🙂

  • @trdd1085
    @trdd1085 2 года назад

    Which IDE do you use

  • @trdd1085
    @trdd1085 2 года назад

    Big fan 🎉

  • @victorvilchis2105
    @victorvilchis2105 2 года назад

    HOW COULD I IMPLEMENT IT USING XAMPP

  • @victorvilchis2105
    @victorvilchis2105 2 года назад

    HOW COULD I IMPLEMENT IT USING XAMPP?

  • @rssimran4800
    @rssimran4800 2 года назад

    Source code link?

  • @devsabuj4818
    @devsabuj4818 2 года назад

    Notice: Undefined index: web/simplest-php-router-master in C:\xampp\htdocs\web\simplest-php-router-master outer.php on line 32 Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in C:\xampp\htdocs\web\simplest-php-router-master outer.php on line 34 error occuring.. not working

  • @anonimowyreptylianin4026
    @anonimowyreptylianin4026 3 года назад

    can you post link to your github?

  • @Ryanisalive
    @Ryanisalive 3 года назад

    Nice videos that solved the problem.❤️❤️❤️❤️❤️ A humble request. Please make videos on React and PHP backend. Suggestion: Try to write long descriptions.

  • @alihamza4362
    @alihamza4362 3 года назад

    Warning: Undefined array key "simplest-php-router-master" in C:\xampp\htdocs\simplest-php-router-master outer.php on line 18 Fatal error: Uncaught TypeError: call_user_func(): Argument #1 ($function) must be a valid callback, no array or string given in C:\xampp\htdocs\simplest-php-router-master outer.php:20 Stack trace: #0 C:\xampp\htdocs\simplest-php-router-master\index.php(15): dispatch('simplest-php-ro...') #1 {main} thrown in C:\xampp\htdocs\simplest-php-router-master outer.php on line 20

  • @sinanasci1
    @sinanasci1 3 года назад

    / works... but /about gives a 404 error back... I am using apache server xampp

  • @sushmitapalikhe8799
    @sushmitapalikhe8799 3 года назад

    This tutorial helps me a lot...Thanks Azeem Hassni.

  • @rezaulkarim2397
    @rezaulkarim2397 3 года назад

    Algorithm series I would love to watch.

  • @saugmaddox349
    @saugmaddox349 3 года назад

    How can we add routes like $route->get('/', [TestController::class, 'show'); Where testController is a class and show is a method inside that class ?? How can we change the callback from null to accept an array..I tried that but its confusing...can you explain how to do this ??

    • @azeemhassni
      @azeemhassni 3 года назад

      You could get it working by changing the type of $callback to callable from Closure in the route function parameters, once you did that you can use class methods as your callback. class TestController { public function show() { return sprintf('Hello from %s@%s', __CLASS__, __METHOD__); } } route('/test', [TestController::class, 'show']);

    • @saugmaddox349
      @saugmaddox349 3 года назад

      @@azeemhassni Its still not working...You made the callback to be null...How do I get that array inside the callback variable without using the pregmatch..the pregmatch function is overriding the $callback = null variable

    • @azeemhassni
      @azeemhassni 3 года назад

      @@saugmaddox349 I’m not sure I follow, could you share what error you see when you try the above?

  • @rxxt-sh1vj
    @rxxt-sh1vj 3 года назад

    Very Well Explained...: Thanks Azim

  • @rxxt-sh1vj
    @rxxt-sh1vj 3 года назад

    How to add named routes to this router like laravel?? Please reply

    • @azeemhassni
      @azeemhassni 3 года назад

      You mean how to give a name to a route? like Laravel does it by calling the `route()->name('customer.show')`?

    • @rxxt-sh1vj
      @rxxt-sh1vj 3 года назад

      @@azeemhassni Yes exactly..and my recommendation is please make the router in Object oriented way..nowadays no good developer uses procedural php...

    • @azeemhassni
      @azeemhassni 3 года назад

      @@rxxt-sh1vj I agree, but the objective of the initial video was to demonstrate the simplest way with as little code as possible, we could probably do another series to build an object oriented router but I'd keep this series procedural/functional for the simplicity reasons.

    • @rxxt-sh1vj
      @rxxt-sh1vj 3 года назад

      @@azeemhassni Okay./.. i agree with you.. I will wait for your oop series for the router....any idea when you will be implementing it ??

  • @rebmansunzu8469
    @rebmansunzu8469 3 года назад

    About page not wotking localhost/about or localhost/learn/about. but home page localhost/learn working. route('/about', function () { return "Hello form the about route"; });

  • @rxxt-sh1vj
    @rxxt-sh1vj 3 года назад

    Well explained...!! yes continue with your reflection API...what you said..I am intereseted in watching that

  • @rikdenbreejen5230
    @rikdenbreejen5230 3 года назад

    Holy shot, this is actually really helpful! Thanks dude!

    • @azeemhassni
      @azeemhassni 3 года назад

      Thanks for the feedback Rik, it really means a lot to me, please checkout the next episode ruclips.net/video/imfPem_X4fE/видео.html I hope that will also be helpful 🙂 .

  • @imdadshafi
    @imdadshafi 3 года назад

    I never comment on videos but your brilliant explanation forces me to tell u that ur explanation and efforts are amazing

    • @azeemhassni
      @azeemhassni 3 года назад

      Thank you so much. ♥️

    • @scott-richardson
      @scott-richardson 2 года назад

      Absolutely agree. Been looking for a very simple explanation for a procedural PHP router for a while and this is by far the best (series) of videos I have found. Well done Azeem.

  • @flyhigh6047
    @flyhigh6047 3 года назад

    Dayum i just watched the previous video and this came out :D

    • @azeemhassni
      @azeemhassni 3 года назад

      Loved your comment. gave me a smile. :)

  • @azeemhassni
    @azeemhassni 3 года назад

    Episode 2 is here ruclips.net/video/hwNppHeKrag/видео.html

  • @rizwanellahi9624
    @rizwanellahi9624 3 года назад

    Dynamic routes are really useful. Thanks for sharing

    • @azeemhassni
      @azeemhassni 3 года назад

      Anytime, Hope this was helpful.

  • @marcosoriano4544
    @marcosoriano4544 3 года назад

    I am getting this warning Warning: call_user_func() expects parameter 1

    • @azeemhassni
      @azeemhassni 3 года назад

      That probably means you are registering your routes incorrectly, It will be easier to help if you share some code.

  • @lordth33nd36
    @lordth33nd36 3 года назад

    tks its very simple e much power <3

  • @TheTrooperG
    @TheTrooperG 4 года назад

    Here's a question. If something else is in the url that's not in the array (ie. wrong url) it throws an error. What's the best way to catch this and direct to the homepage instead?

    • @azeemhassni
      @azeemhassni 3 года назад

      I will be releasing the next episode soon, which covers dynamic routes and 404 error handling. hope that will be helpful.

    • @azeemhassni
      @azeemhassni 3 года назад

      @ Episode 2 is here ruclips.net/video/hwNppHeKrag/видео.html which covers dynamic routes and 404 error handling.

  • @danamulyana
    @danamulyana 4 года назад

    Thanks you for sharing

  • @nielfernandez5487
    @nielfernandez5487 4 года назад

    Notice: Undefined index: projects/route in D:\wamp64\www\projects oute outer.php on line 32 Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in D:\wamp64\www\projects oute outer.php on line 34 .... ibb.co/NmGQwcj ... Pls. Help Thanks

  • @mohammadhashemi308
    @mohammadhashemi308 4 года назад

    hi... thanks I have a problem... when I add 'about' in my url, page gets an NOT FOUND error ... I used your code and just add my project folder name in the function like this: route('/project/about/', function () { return "Hello form the about route"; });

  • @--INDIAN--TRADER
    @--INDIAN--TRADER 4 года назад

    So less likes

    • @azeemhassni
      @azeemhassni 3 года назад

      Thanks for the comment, and liking the video. :)

  • @UnboxTek
    @UnboxTek 4 года назад

    how about hiding the "controller", "method" and get all the params value? ex: domain.test/controller/method/username to: domain.test/username or ex: domain.test/controller/method/?video=1212 to: domain.test/video/1212 Thanks

  • @abidtkg
    @abidtkg 4 года назад

    I got something best, thanks for sharing knowledge.

    • @azeemhassni
      @azeemhassni 3 года назад

      So nice of you, I'm glad it was helpful for you.

  • @marcuskjneed583
    @marcuskjneed583 4 года назад

    its not work with i had problem call_user_func() expects parameter 1 to be a valid callback, no array or string given

    • @eskelsen1417
      @eskelsen1417 4 года назад

      You must be working in a subdirectory, so you must report this in the function's arguments. For "index.php", for example: route('/subfolder', function () { return 'Hello World'; });

    • @sumitkajbaje
      @sumitkajbaje 4 года назад

      @anti gay anglo saxon western culture Same here

    • @azeemhassni
      @azeemhassni 3 года назад

      If one one you can explain the issue you are having or show me the code, I can probably help.

    • @sumitkajbaje
      @sumitkajbaje 3 года назад

      @@azeemhassni it's fixed by @Eskelsen solution

    • @azeemhassni
      @azeemhassni 3 года назад

      @@sumitkajbaje Awesome, glad to hear that.

  • @abctvchannel3575
    @abctvchannel3575 5 лет назад

    niCe Gop

  • @bensolien531
    @bensolien531 5 лет назад

    Great Job Azeem

    • @azeemhassni
      @azeemhassni 3 года назад

      Thanks, hope it was helpful. If you are interested I have posted another episode which extends this to support dynamic routes.

  • @temaovchinnikov3927
    @temaovchinnikov3927 5 лет назад

    Perfectly! Show please OOP + MVC + AJAX + JSON + history api -.htaccess AddDefaultCharset UTF-8 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] -index.php <?php error_reporting(E_ALL); require_once 'route.php'; -route.php <?php $action = $_SERVER['REQUEST_URI']; $routes = []; route('/', function() { return 'Home page'; }); route('/about', function() { return 'About page'; }); dispath($action); function route($action = null, $callback = null) { global $routes; $action = trim($action, '/'); $routes[$action] = $callback; } function dispath($action = null) { global $routes; $action = trim($action, '/'); $callback = $routes[$action]; call_user_func($callback); }

  • @imranraja1322
    @imranraja1322 6 лет назад

    what if url is dynamic like user/1 or user/profile/1????

    • @azeemhassni
      @azeemhassni 6 лет назад

      Imran Raja the idea was to create the simplest possible solution, but if you want you can add regex or dynamic routing to it. Let me know if you need help.

    • @豆皮本人
      @豆皮本人 5 лет назад

      thats what i need too but still have no clue

    • @azeemhassni
      @azeemhassni 5 лет назад

      I will try to record a video on that, soon as I get some free time.

    • @azeemhassni
      @azeemhassni 3 года назад

      Episode 2 is here ruclips.net/video/hwNppHeKrag/видео.html which covers dynamic routes

  • @imdadshafi
    @imdadshafi 6 лет назад

    Great