V
V
VladRife2021-06-14 18:00:43
PHP
VladRife, 2021-06-14 18:00:43

How can a class be called without creating an instance?

We need to call the class without creating an instance of it, here is the code:

$filesystem = new FileSystem();
$filesystem->DeleteAllDirectory('../../server/users/' . $_SESSION['user']['user_folder']);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gian_tiaga, 2021-06-14
@VladRife

For non-static methods, you must create an instance, but you can do this

(new FileSystem())->DeleteAllDirectory('../../server/users/' . $_SESSION['user']['user_folder']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question