test - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of test.php
- <?php
- $jsonString = '[
- {
- id: 1,
- title: "SYSTEM MANAGEMENT",
- listItems: [
- {
- id: 1,
- title: "Add User",
- url: "/admin/add-user",
- icon: "fas fa-user",
- },
- {
- id: 2,
- title: "User Management",
- url: "/admin/users",
- icon: "fas fa-regular fa-user",
- },
- {
- id: 3,
- title: "Add User Role",
- url: "/admin/add-user-role",
- icon: "fas fa-users",
- },
- {
- id: 4,
- title: "User Role Management",
- url: "/admin/user-roles",
- icon: "fas fa-users",
- },
- {
- id: 5,
- title: "Add Module",
- url: "/admin/add-module",
- icon: "fas fa-file-circle-plus",
- },
- {
- id: 6,
- title: "Module Management",
- url: "/admin/modules",
- icon: "fas fa-file-lines",
- },
- ],
- },
- {
- id: 2,
- title: "SETTINGS",
- listItems: [
- {
- id: 1,
- title: "Basic Information",
- url: "/admin/information",
- icon: "fas fa-circle-info",
- },
- {
- id: 2,
- title: "Themes",
- url: "/admin/theme",
- icon: "fas fa-palette",
- },
- {
- id: 3,
- title: "Page Builder",
- url: "/admin/page-builder",
- icon: "fas fa-swatchbook",
- },
- {
- id: 4,
- title: "Navigation",
- url: "/admin/navigation",
- icon: "fas fa-bars",
- },
- {
- id: 5,
- title: "Translation",
- url: "/admin/translation",
- icon: "fas fa-language",
- },
- {
- id: 6,
- title: "Optimization",
- url: "/admin/optimization",
- icon: "fas fa-globe",
- },
- ],
- },
- {
- id: 3,
- title: "CUSTOM LINK",
- listItems: [
- {
- id: 1,
- title: "Generate Link",
- url: "/admin/custom-link",
- icon: "fas fa-link",
- },
- ],
- },
- {
- id: 4,
- title: "ADMIN LAYOUT PAGES",
- listItems: [
- {
- id: 1,
- title: "Dashboard",
- url: "/admin/dashboard",
- icon: "fas fa-tv",
- },
- {
- id: 2,
- title: "Settings",
- url: "/admin/settings",
- icon: "fas fa-tools",
- },
- {
- id: 3,
- title: "Tables",
- url: "/admin/tables",
- icon: "fas fa-table",
- },
- {
- id: 4,
- title: "Data Tables",
- url: "/admin/datatables",
- icon: "fas fa-table",
- },
- {
- id: 5,
- title: "Maps",
- url: "/admin/maps",
- icon: "fas fa-map-marked",
- },
- ],
- },
- {
- id: 5,
- title: "AUTH LAYOUT PAGES",
- listItems: [
- {
- id: 1,
- title: "Login",
- url: "/auth/login",
- icon: "fas fa-fingerprint",
- },
- {
- id: 2,
- title: "Register",
- url: "/auth/register",
- icon: "fas fa-clipboard-list",
- },
- {
- id: 3,
- title: "404 Not Found",
- url: "/admin/not-found",
- icon: "fas fa-ban",
- },
- ]
- },
- {
- id: 6,
- title: "NO LAYOUT PAGES",
- listItems: [
- {
- id: 1,
- title: "Landing Page",
- url: "/auth/login",
- icon: "fas fa-newspaper",
- },
- {
- id: 2,
- title: "Profile Page",
- url: "/auth/register",
- icon: "fas fa-user-circle",
- }
- ]
- },
- {
- id: 7,
- title: "DOCUMENTATION",
- listItems: [
- {
- id: 1,
- title: "Styles",
- url: "/public",
- icon: "fas fa-paint-brush",
- },
- {
- id: 2,
- title: "CSS Components",
- url: "/auth",
- icon: "fas fa-css3-alt",
- },
- {
- id: 3,
- title: "Angular",
- url: "/auth",
- icon: "fas fa-angular",
- },
- {
- id: 4,
- title: "Javascript",
- url: "/auth",
- icon: "fas fa-js-square",
- },
- {
- id: 5,
- title: "NextJS",
- url: "/auth",
- icon: "fas fa-react",
- },
- {
- id: 6,
- title: "React",
- url: "/auth",
- icon: "fas fa-react",
- },
- {
- id: 7,
- title: "Svelte",
- url: "/auth",
- icon: "fas fa-link",
- },
- {
- id: 8,
- title: "VueJS",
- url: "/auth",
- icon: "fas fa-vuejs",
- },
- ]
- },
- ]';
- // Decode the JSON string into a PHP variable (an object)
- $data = json_decode($jsonString);
- // Convert the object to an array with associative keys (for "title" and "listItems")
- $dataArray = json_decode(json_encode($data), true);
- print_r($dataArray);
- ?>