php: convert an object to array
2019-11-09
IN1, 2019-11-09 00:00:00
IN1, 2023-04-10 14:16:30


Q: how to convert an object to array with php?

A: use the following recursive function convertObjectToArray to achieve this.

/**
 * @param mixed $mObject
 * @return array
 */
function convertObjectToArray($mObject)
{
    (is_object($mObject)) ? $mObject = (array) $mObject : false;

    if(is_array($mObject))
    {
        $aNew = array();

        foreach($mObject as $sKey => $mValue)
        {
            $sFirstChar […]

myMVC von überall aus verwenden
2019-10-14
IN1, 2019-10-14 00:00:00
IN1, 2023-04-13 16:19:34


Q: Kann man myMVC und deren Klassen von überall aus verwenden, ohne dass man über den Bootstrapper public/index.php gehen muß ?

A: Ja, das funktioniert. Dazu muß man nur myMVC's bootstrap.php laden.

<?php
require_once '/var/www/myMVC/application/config/util/bootstrap.php';

Danach stehen alle Klassen usw. sofort zur Verfügung.

[…]


This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".