• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

phpjqueryajaxlaravellaravel-5


PHP Snippet 1:

//...
$product  = json_decode($request->product, true);
//...

PHP Snippet 2:

 public function dopayment(Request $request) {

            $input = $request->all();

            $product = json_decode($request->product);


            foreach ($product as $single) {
                # code...

                print_r($single->name);
            }

           print_r($product);
            exit;
        }

PHP Snippet 3:

if (is_array($product ) || is_object($product ))
{
    foreach($product as $arrayItems){
      // Perform x.
    }
}

Related Snippets

XDebug not working in VScode for php debugging

Issue saving card for customer

jQuery Ajax Post with data

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

getting error while enter Command => php artisan route:list

Use Python plotly chart in PHP

how do i retrieve and display the alt text of an image in wordpress?

Fetch files from next cloud storage and display in Laravel website

Webscraping Symfony/Panther: Can't get HTML

How can i call a function that executes an fpdf based on the choice of a form selector?

Laravel unique validation on multiple columns

how to use extended ASCII instead of unicode in PHP

Mysqli Output to a table

Add Class in html Dynamically in PHP

Laravel 5.1 Unknown database type enum requested

About Contact Privacy policy Terms and conditions