• 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

Get number of working days between two dates in PHP [duplicate]

Unable to uninstall brew php from homebrew

SlimExceptionHttpNotFoundException

Fetch files from next cloud storage and display in Laravel website

How to delete old images from public folder on update using Laravel

Laravel: Create morphs() relationship nullable

html-php form submission after validation through JavaScript [closed]

Google Calendar API batch request PHP

Laravel Route issues with Route order in web.php

How to make a array inside array?

Laravel 5.1 Unknown database type enum requested

How to unlink image from folder?

Execute only one time and then wait set period of time before executing again

How to make Canonicals with PHP

Combine array with same value and add other [duplicate]

About Contact Privacy policy Terms and conditions