php – Accessing an instanciated class
Question
I’ve a PHP class doing stuff:
<?php
class Cart {
//....
}
$cart = new Cart();
$cart->init();
function deposit_total(){
global $cart;
$totals = array_sum( $cart::$deposits );
return $totals;
}
How is possible to use the $cart
just instanciated in a function (deposit_total()
) outside the class ?
Thank you
0
11 months
2022-02-26T07:24:59-05:00
2022-02-26T07:24:59-05:00 0 Answers
0 views
0
Leave an answer