Giter Site home page Giter Site logo

Comments (2)

dud3 avatar dud3 commented on July 22, 2024

Code notes:
Note that when getting the associative array from the DB all elements must contain keys otherwise json_decode() will throw a "syntax error" or similar.

  $keywords =  explode(" ", $data);

        $k_db = keywords_list::all()->toArray();

        var_dump($k_db[0]["keywords"]);

        $jf = (string)$k_db[0]["keywords"];

        var_dump($jf);

        // $json_a = json_encode($jf, true);
        trim($jf);

        $json_a = json_decode($jf, true);

         switch (json_last_error()) {
        case JSON_ERROR_NONE:
            echo ' - No errors';
        break;
        case JSON_ERROR_DEPTH:
            echo ' - Maximum stack depth exceeded';
        break;
        case JSON_ERROR_STATE_MISMATCH:
            echo ' - Underflow or the modes mismatch';
        break;
        case JSON_ERROR_CTRL_CHAR:
            echo ' - Unexpected control character found';
        break;
        case JSON_ERROR_SYNTAX:
            echo ' - Syntax error, malformed JSON';
        break;
        case JSON_ERROR_UTF8:
            echo ' - Malformed UTF-8 characters, possibly incorrectly encoded';
        break;default:
            echo ' - Unknown error';
        break;    }

        echo PHP_EOL;

        var_dump($json_a);

        $string='{"name":"John Adams"}';

        var_dump($string);

        $json_b=json_decode($string,true);

        var_dump($json_b);

        var_dump($keywords);

from mailtree.

dud3 avatar dud3 commented on July 22, 2024

The core of the keyword comparator and filter is there.
Closing this for now.

Open a new one for advancing the filter.

from mailtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.