How to show the result of executing a function from a Сlass
-
I had a test task. It was to display the results of the functions on the page
page.php
class MyClass { public function aaa () { echo "It's function aaa"; } static public function bbb () { echo "It's function bbb"; } }
page.php
I tried to get them through<?php class MyClass { public function aaa () { echo "It's function aaa"; } static public function bbb () { echo "It's function bbb"; } } ?> <h1><?php the_title?></h1> <p>Result function aaa = <b><?php add_action('init', 'MyClass::aaa'); ?></b></p> <p>Result function aaa = <b><?php $my_class = new MyClass(); add_action('init', [$my_class, 'bbb']); ?></b></p>
but got nothing. What is the problem of this code ?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to show the result of executing a function from a Сlass’ is closed to new replies.