Tag : Foreach


How to use foreach object in Nodejs ?

Normally, we does use foreach loop in PHP, JS etc, but when i was working on socket programming at that time i require to use foreach of object in server.js. I did also search on google and try to how to use foreach in Node JS. At last i found to use forEach and solve it. so, let's see following example. <strong >Example</strong> <pre class="prettyprint lang-php"> socket.on("newmessage", function(obj) { obj = JSON.parse(obj); obj.forEach(function(items) { console.log(items.userid); var e = "notify-"+items.userid; io.sockets.emit(e, 1); }); }); </pre>

By Hardik Savani | March 31, 2016 | | 4079 Viewer | Category : PHP Laravel Node JS
READ MORE

    Laravel 5 - Confirmation before delete record from database example

    Laravel 5 - Confirmation before delete record from database example

    Open Post

    How to integrate stripe payment gateway in Laravel 5.4 Application ?

    How to integrate stripe payment gateway in Laravel 5.4 Application ?

    Open Post

    How to add ckeditor with image upload in Laravel ?

    How to add ckeditor with image upload in Laravel ?

    Open Post

    Ajax Image Upload using PHP and jQuery Example from scratch

    Ajax Image Upload using PHP and jQuery Example from scratch

    Open Post

    Laravel 5 - Implementing datatables tutorial using yajra package

    Laravel 5 - Implementing datatables tutorial using yajra package

    Open Post

    PHP - How to make dependent dropdown list using jquery Ajax?

    PHP - How to make dependent dropdown list using jquery Ajax?

    Open Post