Skip to content

Tag: php

class does not have a method ‘urldecode’

In PHP how can I use the urldecode() inside a class. I have the following class because it showing the error Warning: array_walk_recursive() expects parameter 2 to be a valid callback, class ‘exam’ does not have a method ‘urldecode’ on line 7 Answer You are passing the current object $…

PHP function working differently for return and echo. Why?

By using the following class: and Calling the function, by the following code, it works fine. But if in the SafeGuardInput class if I replace echo $finaloutput; with return $finaloutput; and then echo $forminput; on the index.php page. It DOES NOT WORK. Please provide a solution. Answer You can’t return…

How to get saved value from dropdown in edit page laravel?

inside EmployeeController in the edit function, i have this code and inside edit.blade.php to display the dropdown i have this code This is the employees table and this is departments table Now, the goal is i want the dropdown on edit page to display department name of the employee belongs to, while the dropd…

Composer install to target folder

I am using Composer v1.10.6 and am trying to get the dependencies to install into a specific folder. File structure is like this: So I want the dependencies defined in composer.json to be installed under /some-folder/vendor, but they are just getting installed to /vendor. What property do I add to composer.js…

Is PHP possible to print out variable source code as string?

I have a simple variable like this Now, PHP comes with several print out function print_r result: var_dump result: I want a function that can print out the original source code like this: result: Is there any function that can achieve this? Answer This should work for the exact “restore array” you…

Php Reload When Document Is Changed

This is my php code, and i am trying to create a chat I know that php isn’t the way to go, but I want to have some fun, and it seems to be working out. Also, I want to ask how do you let the chat let real time. I created a document called chat.txt and maybe i can