Unset values from a multidimensional array from object - php

How can I unset all the setsystemtime elements from this array?
It's php version 4.4
This is the output of an instance inside my code:
2016-10-19T00:54:41-04:00 INFO (6): Array
(
[ * _bootstrap] => Bootstrap Object
(
[_appNamespace:protected] =>
[_resourceLoader:protected] =>
[_application:protected] => PEP_Application Object
(
[_autoloader:protected] => PEP_Autoloader Object
(
[_defaultAutoloader:protected] => Array
(
[0] => PEP_Loader
[1] => loadClass
)
[_fallbackAutoloader:protected] =>
[_internalAutoloader:protected] => Array
(
[0] => PEP_Autoloader Object
*RECURSION*
[1] => _autoload
)
[_namespaces:protected] => Array
(
[Zend_] => 1
[ZendX_] => 1
[WDPRO_] => 1
[PEP_] => 1
[controllers_helpers_] => 1
[Guzzle] => 1
[Symfony] => 1
)
[_suppressNotFoundWarnings:protected] =>
[_zfPath:protected] =>
)
[_bootstrap:protected] => Bootstrap Object
*RECURSION*
[_environment:protected] => local
[_optionKeys:protected] => Array
(
[0] => phpsettings
[1] => includepaths
[2] => bootstrap
[3] => resources
[4] => deviceprofiling
[5] => pluginpaths
[6] => autoloadernamespaces
)
[_options:protected] => Array
(
[resources] => Array
(
[frontController] => Array
(
[controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers
[moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules
)
[layout] => Array
(
[layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts
)
[setsystemtime] => Array
(
[load] => 1
)
[session] => Array
(
[strict] => 1
)
[modules] => Array
(
[0] => api
[1] => trip
[2] => tickets
[3] => events
[4] => passes
[5] => plan
[6] => resortaddons
[7] => debugutils
[8] => visa-instant-credit
)
[view] =>
[log] => Array
(
[logConfig] => /configs/log.ini
)
[stats] => Array
(
[serviceLogLevel] => INFO
[requestResponseLogLevel] => DEBUG
[viewLogLevel] => INFO
[actionLogLevel] => INFO
[appLogLevel] => INFO
[memoryLogLevel] => DEBUG
)
[serviceSuccessLog] => Array
(
[logConfig] => /configs/serviceSuccessLog.ini
)
)
[deviceprofiling] => Array
(
[cookieName] => WDPROView
[timeToLive] => 604800
[cookiePath] => /
[enabled] => 1
[routeBlackList] => Array
(
[0] => /api
[1] => /utils
)
)
[pluginpaths] => Array
(
[PEP_Stats_Resource_] => PEP/Stats/Resource
[PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource
[Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource
)
[autoloadernamespaces] => Array
(
[0] => WDPRO_
[1] => Zend_
[2] => PEP_
[3] => controllers_helpers_
[4] => Guzzle
[5] => Symfony
)
)
)
[_environment:protected] =>
[_optionKeys:protected] => Array
(
[0] => phpsettings
[1] => includepaths
[2] => bootstrap
[3] => resources
[4] => deviceprofiling
[5] => pluginpaths
[6] => autoloadernamespaces
)
[_options:protected] => Array
(
[phpSettings] => Array
(
[log_errors] => 1
[date] => Array
(
[timezone] => America/New_York
)
[display_startup_errors] => 0
[display_errors] => 1
[error_reporting] => 32767
[error_log] => C:\LodgingPhp\com-ui-php\target/logs/php_error.log
)
[includePaths] => Array
(
[library] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library
)
[bootstrap] => Array
(
[path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/Bootstrap.php
[class] => Bootstrap
)
[resources] => Array
(
[frontController] => Array
(
[controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers
[moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules
)
[layout] => Array
(
[layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts
)
[setsystemtime] => Array
(
[load] => 1
)
[session] => Array
(
[strict] => 1
)
[modules] => Array
(
[0] => api
[1] => trip
[2] => tickets
[3] => events
[4] => passes
[5] => plan
[6] => resortaddons
[7] => debugutils
[8] => visa-instant-credit
)
[view] =>
[log] => Array
(
[logConfig] => /configs/log.ini
)
[stats] => Array
(
[serviceLogLevel] => INFO
[requestResponseLogLevel] => DEBUG
[viewLogLevel] => INFO
[actionLogLevel] => INFO
[appLogLevel] => INFO
[memoryLogLevel] => DEBUG
)
[serviceSuccessLog] => Array
(
[logConfig] => /configs/serviceSuccessLog.ini
)
)
[deviceprofiling] => Array
(
[cookieName] => WDPROView
[timeToLive] => 604800
[cookiePath] => /
[enabled] => 1
[routeBlackList] => Array
(
[0] => /api
[1] => /utils
)
)
[pluginpaths] => Array
(
[PEP_Stats_Resource_] => PEP/Stats/Resource
[PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource
[Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource
)
[autoloadernamespaces] => Array
(
[0] => WDPRO_
[1] => Zend_
[2] => PEP_
[3] => controllers_helpers_
[4] => Guzzle
[5] => Symfony
)
)
[_pluginLoader:protected] =>
[_pluginResources:protected] => Array
(
[layout] => Array
(
[layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts
)
[setsystemtime] => Array
(
[load] => 1
)
[session] => Array
(
[strict] => 1
)
[modules] => Array
(
[0] => api
[1] => trip
[2] => tickets
[3] => events
[4] => passes
[5] => plan
[6] => resortaddons
[7] => debugutils
[8] => visa-instant-credit
)
[view] =>
[log] => Array
(
[logConfig] => /configs/log.ini
)
[stats] => Array
(
[serviceLogLevel] => INFO
[requestResponseLogLevel] => DEBUG
[viewLogLevel] => INFO
[actionLogLevel] => INFO
[appLogLevel] => INFO
[memoryLogLevel] => DEBUG
)
[serviceSuccessLog] => Array
(
[logConfig] => /configs/serviceSuccessLog.ini
)
[frontcontroller] => Zend_Application_Resource_Frontcontroller Object
(
[_front:protected] =>
[_bootstrap:protected] => Bootstrap Object
*RECURSION*
[_options:protected] => Array
(
[controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers
[moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules
)
[_skipOptions:protected] => Array
(
[0] => options
[1] => config
)
)
)
[_run:protected] => Array
(
[0] => autoload
)
[_started:protected] => Array
(
[core] => 1
)
)
[ * _options] => Array
(
)
[ * _skipOptions] => Array
(
[0] => options
[1] => config
)
)
I tried with something like this and some variations for unset doesn't make the work... any idea?
foreach($a as $key => $b)
{
if($b == 'setsystemtime')
{
unset($a[$key]);
}
}
Looking for other answers I also try this:
foreach (array_keys($a, 'setsystemtime' , true) as $key) {
$logger->info('encontro a setsystem time!!!!!');
unset($a[$key]);
}
But never enters on it.
Thanks all!!

Related

Laravel - How can I add new array key with value to the collection output

I have this query:
$get_products = Cache::rememberForever('all_imports', function () use ($collection) {
return DB::connection('mongodb')->collection( $collection )->paginate( self::NO_OF_PRODUCTS );
});
If I print_r this output:
echo '<pre>';
print_r( $get_products );
echo '</pre>';
I got this request:
Illuminate\Pagination\LengthAwarePaginator Object
(
[items:protected] => Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] => Array
(
[_id] => MongoDB\BSON\ObjectId Object
(
[oid] => 639e0f59889929ce620f4e9c
)
[id] => 35035
[availability] => In stock
[brand] => Bogas Primavara Vara
[condition] => new
[date_add] => 1671303001
[date_upd] => 1673865782
[description] => Rochie dama scurta catifea neagra Antonietta Bogas Rochie dama scurta catifea neagra Antonietta Bogas
[image_link] => https://www.bogas.ro/continut/produse/35035/1000/rochie-dama-scurta-catifea-neagra-antonietta-bogas_126777.jpeg
[link] => https://www.bogas.ro/rochie-dama-scurta-catifea-neagra-antonietta-bogas/?utm_source=googlemerchantcenter&utm_medium=cpc&utm_campaign=direct_link
[price] => 229.99 RON
[product_type] => Rochii
[sale_price] => 149.99 RON
[title] => Rochie dama scurta catifea neagra Antonietta Bogas
[update_history] => Array
(
[0] => Array
(
[id_feed] => 269
[feed_name] => bogas direct
[date_upd] => 1673865782
[field_history] => Array
(
)
)
)
[all_sizes] => Array
(
[0] => XS
[1] => S
[2] => M
[3] => L
[4] => XL
)
[sizes_out_of_stock] => Array
(
)
[additional_image_link] => Array
(
[0] => https://www.bogas.ro/continut/produse/35035/520/rochie-dama-scurta-catifea-neagra-antonietta-bogas_126775.jpeg
[1] => https://www.bogas.ro/continut/produse/35035/520/rochie-dama-scurta-catifea-neagra-antonietta-bogas_126776.jpeg
)
[all_attributes] => Array
(
[0] => Negru
[1] => Negru
[2] => Negru
[3] => Negru
[4] => Negru
)
[ean13] =>
[in_stock_attributes] => Array
(
[0] => Negru
[1] => Negru
[2] => Negru
[3] => Negru
[4] => Negru
)
[specs] => Array
(
[Material] => Catifea
)
[total_optiuni_out_of_stock] => Array
(
)
[clicks_last_30days_present] => 0
[field_update] => Array
(
[clicks_last_30days_present] => 1673872147
[cost_last_30days_present] => 1673872147
[conversions_last_30days_present] => 1673872147
[conversions_value_last_30days_present] => 1673872147
[impressions_last_30days_present] => 1673872147
[roas_last_30days_present] => 1673872147
)
[cost_last_30days_present] => 0
[conversions_last_30days_present] => 0
[conversions_value_last_30days_present] => 0
[impressions_last_30days_present] => 4
[roas_last_30days_present] => 0
)
)
[escapeWhenCastingToString:protected] =>
)
[perPage:protected] => 1
[currentPage:protected] => 1
[path:protected] => http://127.0.0.1:8000/api/price-monitor/matching/your-product/97-0048-2571-870/1
[query:protected] => Array
(
)
[fragment:protected] =>
[pageName:protected] => page
[onEachSide] => 3
[options:protected] => Array
(
[path] => http://127.0.0.1:8000/api/price-monitor/matching/your-product/97-0048-2571-870/1
[pageName] => page
)
[total:protected] => 830
[lastPage:protected] => 830
)
Now, I want to added a new array key with value to the output. So, I am doing this:
if( isset( $get_products[0]['additional_image_link'] ) && ! empty( $get_products[0]['additional_image_link'] ) ) {
$get_products[0]['carousel_images'] = $get_products[0]['additional_image_link'];
}
But I got an error message :
Indirect modification of overloaded element of
Illuminate\Pagination\LengthAwarePaginator has no effect

Cannot serialize and unserialize an object to delete an object element PHP

Getting an instance like this:
$coreBootstrap = new PEP_Application_BootstrapCore(array('bootstrap' => $this));
Receives this object:
PEP_Application_BootstrapCore Object ( [_bootstrap:protected] => Bootstrap Object ( [_appNamespace:protected] => [_resourceLoader:protected] => [_application:protected] => PEP_Application Object ( [_autoloader:protected] => PEP_Autoloader Object ( [_autoloaders:protected] => Array ( [0] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) [_defaultAutoloader:protected] => Array ( [0] => PEP_Loader [1] => loadClass ) [_fallbackAutoloader:protected] => [_internalAutoloader:protected] => Array ( [0] => PEP_Autoloader Object *RECURSION* [1] => _autoload ) [_namespaces:protected] => Array ( [Zend_] => 1 [ZendX_] => 1 [WDPRO_] => 1 [PEP_] => 1 [controllers_helpers_] => 1 [Guzzle] => 1 [Symfony] => 1 ) [_namespaceAutoloaders:protected] => Array ( [Default_] => Array ( [0] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) ) [_suppressNotFoundWarnings:protected] => [_zfPath:protected] => ) [_bootstrap:protected] => Bootstrap Object *RECURSION* [_environment:protected] => local [_optionKeys:protected] => Array ( [0] => phpsettings [1] => includepaths [2] => bootstrap [3] => resources [4] => deviceprofiling [5] => pluginpaths [6] => autoloadernamespaces ) [_options:protected] => Array ( [phpSettings] => Array ( [log_errors] => 1 [date] => Array ( [timezone] => America/New_York ) [display_startup_errors] => 0 [display_errors] => 1 [error_reporting] => 32767 [error_log] => C:\LodgingPhp\com-ui-php\target/logs/php_error.log ) [includePaths] => Array ( [library] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library ) [bootstrap] => Array ( [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/Bootstrap.php [class] => Bootstrap ) [resources] => Array ( [frontController] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) ) [deviceprofiling] => Array ( [cookieName] => WDPROView [timeToLive] => 604800 [cookiePath] => / [enabled] => 1 [routeBlackList] => Array ( [0] => /api [1] => /utils ) ) [pluginpaths] => Array ( [PEP_Stats_Resource_] => PEP/Stats/Resource [PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource [Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource ) [autoloadernamespaces] => Array ( [0] => WDPRO_ [1] => Zend_ [2] => PEP_ [3] => controllers_helpers_ [4] => Guzzle [5] => Symfony ) ) ) [_classResources:protected] => Array ( [autoload] => _initAutoload [core] => _initCore [router] => _initRouter [servicestub] => _initServiceStub [mediaengineconfig] => _initMediaEngineConfig [viewhelpers] => _initViewHelpers [configurablestoreplugin] => _initConfigurableStorePlugin [languagesetupplugin] => _initLanguageSetupPlugin [keywordrouterplugin] => _initKeywordRouterPlugin [tripconfig] => _initTripConfig [dclkeepalive] => _initDclKeepAlive [helpconfig] => _initHelpConfig [analyticsgenericplugin] => _initAnalyticsGenericPlugin [postdispatchstatsdplugin] => _initPostDispatchStatsDPlugin [curoauthplugin] => _initCUROAuthPlugin [sessionserviceshdrplugin] => _initSessionServiceShdrPlugin ) [_container:protected] => Zend_Registry Object ( [storage:ArrayObject:private] => Array ( [autoload] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) ) [_environment:protected] => [_optionKeys:protected] => Array ( [0] => phpsettings [1] => includepaths [2] => bootstrap [3] => resources [4] => deviceprofiling [5] => pluginpaths [6] => autoloadernamespaces ) [_options:protected] => Array ( [phpSettings] => Array ( [log_errors] => 1 [date] => Array ( [timezone] => America/New_York ) [display_startup_errors] => 0 [display_errors] => 1 [error_reporting] => 32767 [error_log] => C:\LodgingPhp\com-ui-php\target/logs/php_error.log ) [includePaths] => Array ( [library] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library ) [bootstrap] => Array ( [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/Bootstrap.php [class] => Bootstrap ) [resources] => Array ( [frontController] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) ) [deviceprofiling] => Array ( [cookieName] => WDPROView [timeToLive] => 604800 [cookiePath] => / [enabled] => 1 [routeBlackList] => Array ( [0] => /api [1] => /utils ) ) [pluginpaths] => Array ( [PEP_Stats_Resource_] => PEP/Stats/Resource [PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource [Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource ) [autoloadernamespaces] => Array ( [0] => WDPRO_ [1] => Zend_ [2] => PEP_ [3] => controllers_helpers_ [4] => Guzzle [5] => Symfony ) ) [_pluginLoader:protected] => [_pluginResources:protected] => Array ( [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) [frontcontroller] => Zend_Application_Resource_Frontcontroller Object ( [_front:protected] => [_bootstrap:protected] => Bootstrap Object *RECURSION* [_options:protected] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [_skipOptions:protected] => Array ( [0] => options [1] => config ) ) ) [_run:protected] => Array ( [0] => autoload ) [_started:protected] => Array ( [core] => 1 ) ) [_options:protected] => Array ( ) [_skipOptions:protected] => Array ( [0] => options [1] => config ) )
I need to remove the setsystemtime part:
[setsystemtime] => Array ( [load] => )
but I cannot reach it, I have tried casting the array and later making an array_search but I get: "It brings Array to string conversion":
$coreBootstrap = array_merge(array_diff((array) $coreBootstrap, array('setsystemtime')));
Also I tried the following:
$a = serialize($coreBootstrap);
$x =json_encode($a);
$x= str_replace('s:13:\"setsystemtime\";a:1:{s:4:\"load\";s:1:\"1\";}', "", $x);
$a = json_decode($x, true);
$a = unserialize($a); // this brings an error and page doesnt load
// $logger->info($a);
$a = (object) $a;
$logger->info($x);
// $a->init();
$coreBootstrap->init();
Also
It's php 5.4.4
Any ideas?
Thank You!
Instead of trying to cast the array, why not cast $coreBootstrap to an array and unset the index, and then serialize or cast it back to an object?
// this should be done for each subindex that is also an object.
$a = (array) $coreBootstrap;
unset($a[..the index..]);
$a = (object) $a;
One can also try to go for a complete recursive conversion, but this might not be wanted:
$a = json_decode(json_encode($coreBootstrap, JSON_FORCE_OBJECT), false);
Its just better to do this specifically when dealing with a large array containing array's and objects.
$a = (array) $coreBootstrap->objectvar->objectvar;
unset($a[idofindex]);
$a = (object) $coreBootstrap->objectvar->objectvar;
$coreBootstrap->objectvar->objectvar = $a;

Remove an element from array PHP

Getting an instance like this:
$coreBootstrap = new PEP_Application_BootstrapCore(array('bootstrap' => $this));
Receives this object:
PEP_Application_BootstrapCore Object ( [_bootstrap:protected] => Bootstrap Object ( [_appNamespace:protected] => [_resourceLoader:protected] => [_application:protected] => PEP_Application Object ( [_autoloader:protected] => PEP_Autoloader Object ( [_autoloaders:protected] => Array ( [0] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) [_defaultAutoloader:protected] => Array ( [0] => PEP_Loader [1] => loadClass ) [_fallbackAutoloader:protected] => [_internalAutoloader:protected] => Array ( [0] => PEP_Autoloader Object *RECURSION* [1] => _autoload ) [_namespaces:protected] => Array ( [Zend_] => 1 [ZendX_] => 1 [WDPRO_] => 1 [PEP_] => 1 [controllers_helpers_] => 1 [Guzzle] => 1 [Symfony] => 1 ) [_namespaceAutoloaders:protected] => Array ( [Default_] => Array ( [0] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) ) [_suppressNotFoundWarnings:protected] => [_zfPath:protected] => ) [_bootstrap:protected] => Bootstrap Object *RECURSION* [_environment:protected] => local [_optionKeys:protected] => Array ( [0] => phpsettings [1] => includepaths [2] => bootstrap [3] => resources [4] => deviceprofiling [5] => pluginpaths [6] => autoloadernamespaces ) [_options:protected] => Array ( [phpSettings] => Array ( [log_errors] => 1 [date] => Array ( [timezone] => America/New_York ) [display_startup_errors] => 0 [display_errors] => 1 [error_reporting] => 32767 [error_log] => C:\LodgingPhp\com-ui-php\target/logs/php_error.log ) [includePaths] => Array ( [library] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library ) [bootstrap] => Array ( [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/Bootstrap.php [class] => Bootstrap ) [resources] => Array ( [frontController] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) ) [deviceprofiling] => Array ( [cookieName] => WDPROView [timeToLive] => 604800 [cookiePath] => / [enabled] => 1 [routeBlackList] => Array ( [0] => /api [1] => /utils ) ) [pluginpaths] => Array ( [PEP_Stats_Resource_] => PEP/Stats/Resource [PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource [Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource ) [autoloadernamespaces] => Array ( [0] => WDPRO_ [1] => Zend_ [2] => PEP_ [3] => controllers_helpers_ [4] => Guzzle [5] => Symfony ) ) ) [_classResources:protected] => Array ( [autoload] => _initAutoload [core] => _initCore [router] => _initRouter [servicestub] => _initServiceStub [mediaengineconfig] => _initMediaEngineConfig [viewhelpers] => _initViewHelpers [configurablestoreplugin] => _initConfigurableStorePlugin [languagesetupplugin] => _initLanguageSetupPlugin [keywordrouterplugin] => _initKeywordRouterPlugin [tripconfig] => _initTripConfig [dclkeepalive] => _initDclKeepAlive [helpconfig] => _initHelpConfig [analyticsgenericplugin] => _initAnalyticsGenericPlugin [postdispatchstatsdplugin] => _initPostDispatchStatsDPlugin [curoauthplugin] => _initCUROAuthPlugin [sessionserviceshdrplugin] => _initSessionServiceShdrPlugin ) [_container:protected] => Zend_Registry Object ( [storage:ArrayObject:private] => Array ( [autoload] => Zend_Application_Module_Autoloader Object ( [_basePath:protected] => C:\LodgingPhp\com-ui-php\target\packaged-application\application [_components:protected] => Array ( [Default_Controller_Action_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers [Default_Module] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules [Default_Model_DbTable] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable [Default_Model_Mapper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers [Default_Form] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms [Default_Model] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models [Default_Plugin] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins [Default_Service] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services [Default_View_Helper] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers [Default_View_Filter] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) [_defaultResourceType:protected] => model [_namespace:protected] => Default [_resourceTypes:protected] => Array ( [actionhelper] => Array ( [namespace] => Default_Controller_Action_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers/actions/helpers ) [module] => Array ( [namespace] => Default_Module [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [dbtable] => Array ( [namespace] => Default_Model_DbTable [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/DbTable ) [mappers] => Array ( [namespace] => Default_Model_Mapper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models/mappers ) [form] => Array ( [namespace] => Default_Form [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/forms ) [model] => Array ( [namespace] => Default_Model [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/models ) [plugin] => Array ( [namespace] => Default_Plugin [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/plugins ) [service] => Array ( [namespace] => Default_Service [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/services ) [viewhelper] => Array ( [namespace] => Default_View_Helper [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/helpers ) [viewfilter] => Array ( [namespace] => Default_View_Filter [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/views/filters ) ) ) ) ) [_environment:protected] => [_optionKeys:protected] => Array ( [0] => phpsettings [1] => includepaths [2] => bootstrap [3] => resources [4] => deviceprofiling [5] => pluginpaths [6] => autoloadernamespaces ) [_options:protected] => Array ( [phpSettings] => Array ( [log_errors] => 1 [date] => Array ( [timezone] => America/New_York ) [display_startup_errors] => 0 [display_errors] => 1 [error_reporting] => 32767 [error_log] => C:\LodgingPhp\com-ui-php\target/logs/php_error.log ) [includePaths] => Array ( [library] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library ) [bootstrap] => Array ( [path] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/Bootstrap.php [class] => Bootstrap ) [resources] => Array ( [frontController] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) ) [deviceprofiling] => Array ( [cookieName] => WDPROView [timeToLive] => 604800 [cookiePath] => / [enabled] => 1 [routeBlackList] => Array ( [0] => /api [1] => /utils ) ) [pluginpaths] => Array ( [PEP_Stats_Resource_] => PEP/Stats/Resource [PEP_Application_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/../library/PEP/Application/Resource [Default_Resource_] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/resource ) [autoloadernamespaces] => Array ( [0] => WDPRO_ [1] => Zend_ [2] => PEP_ [3] => controllers_helpers_ [4] => Guzzle [5] => Symfony ) ) [_pluginLoader:protected] => [_pluginResources:protected] => Array ( [layout] => Array ( [layoutPath] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/layouts/scripts ) [setsystemtime] => Array ( [load] => ) [session] => Array ( [strict] => ) [modules] => Array ( [0] => api [1] => tickets [2] => events [3] => passes [4] => plan [5] => resortaddons [6] => debugutils [7] => visa-instant-credit ) [view] => [log] => Array ( [logConfig] => /configs/log.ini ) [stats] => Array ( [serviceLogLevel] => INFO [requestResponseLogLevel] => DEBUG [viewLogLevel] => INFO [actionLogLevel] => INFO [appLogLevel] => INFO [memoryLogLevel] => DEBUG ) [serviceSuccessLog] => Array ( [logConfig] => /configs/serviceSuccessLog.ini ) [frontcontroller] => Zend_Application_Resource_Frontcontroller Object ( [_front:protected] => [_bootstrap:protected] => Bootstrap Object *RECURSION* [_options:protected] => Array ( [controllerDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/controllers [moduleDirectory] => C:\LodgingPhp\com-ui-php\target\packaged-application\application/modules ) [_skipOptions:protected] => Array ( [0] => options [1] => config ) ) ) [_run:protected] => Array ( [0] => autoload ) [_started:protected] => Array ( [core] => 1 ) ) [_options:protected] => Array ( ) [_skipOptions:protected] => Array ( [0] => options [1] => config ) )
When I try:
$coreBootstrap = array_merge(array_diff($coreBootstrap, array('setsystemtime')));
I receive this message:
"array_merge(): Argument #1 is not an array in...."
I need to remove the setsystemtime, but I cannot reach it, I have tried also array_search but I get a similar error.
It's php 5.4.4
With the help obtained I figured that this is an object. I need that the part of the object 'setsystemtime' and their values get removed.
Any ideas?
Thank You!
You can cast the object as an array:
$coreBootstrap = array_merge(array_diff((array) $coreBootstrap, array('setsystemtime')));

Read object/array in PHP

I am working on Facebook leads API and successfully getting response for my lead
use FacebookAds\Object\Lead;
$form = new Lead('LEAD_ID');
$re = $form->read();
echo '<pre>';
print_r($re);
and the response is in following format :
FacebookAds\Object\Lead Object
(
[changedFields:protected] => Array
(
)
[api:protected] => FacebookAds\Api Object
(
[session:FacebookAds\Api:private] => FacebookAds\Session Object
(
[appId:protected] => 448283968712152
[appSecret:protected] => 0cf8998603f3050f9d80ded4cecdb7f7
[accessToken:protected] => EAAGXtj62rdgBAP0ZCjmnddu3ZBIgZAECUluzPL6CGUuZB07tPUlERk4L1iRb2gy31qlUx2ExBENZBegpvfHxmxsJYks8rghrKOZBHMWEblEgsIvo5GF3ySzbyVszg7lbYIuBSgeFdzAMq6GuW6iZCQrgXd4KfAVoiQZD
[appSecretProof:protected] => c6112ce522414623dea1fb41cc29f6f15ca480845b8490d7c45ec67a485fa3f6
)
[logger:protected] => FacebookAds\Logger\NullLogger Object
(
)
[httpClient:protected] => FacebookAds\Http\Client Object
(
[requestPrototype:protected] => FacebookAds\Http\Request Object
(
[client:protected] => FacebookAds\Http\Client Object
*RECURSION*
[headers:protected] =>
[method:protected] => GET
[protocol:protected] => https://
[domain:protected] =>
[path:protected] =>
[graphVersion:protected] =>
[queryParams:protected] =>
[bodyParams:protected] =>
[fileParams:protected] =>
)
[responsePrototype:protected] => FacebookAds\Http\Response Object
(
[request:protected] =>
[statusCode:protected] =>
[headers:protected] =>
[body:protected] =>
[content:protected] =>
)
[defaultRequestHeaders:protected] => FacebookAds\Http\Headers Object
(
[storage:ArrayObject:private] => Array
(
[User-Agent] => fb-php-ads-2.5.1
[Accept-Encoding] => *
)
)
[adapter:protected] => FacebookAds\Http\Adapter\CurlAdapter Object
(
[curl:protected] => FacebookAds\Http\Adapter\Curl\Curl Object
(
[handle:protected] => Resource id #34
)
[opts:protected] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[78] => 10
[13] => 60
[19913] => 1
[42] => 1
[10065] => /home/leadsgeneration/public_html/v1/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/../../../fb_ca_chain_bundle.crt
)
)
[client:protected] => FacebookAds\Http\Client Object
*RECURSION*
)
[caBundlePath:protected] => /home/leadsgeneration/public_html/v1/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/../../../fb_ca_chain_bundle.crt
[defaultGraphBaseDomain:protected] => facebook.com
)
[defaultGraphVersion:protected] => 2.5
)
[parentId:protected] =>
[data:protected] => Array
(
[ad_id] =>
[adset_id] =>
[campaign_id] =>
[created_time] => 2016-04-18T04:17:55+0000
[field_data] => Array
(
[0] => Array
(
[name] => email
[values] => Array
(
[0] => varunroute69#gmail.com
)
)
[1] => Array
(
[name] => phone_number
[values] => Array
(
[0] => +919731688688
)
)
[2] => Array
(
[name] => full_name
[values] => Array
(
[0] => Varun Majety
)
)
)
[form_id] =>
[id] => 571052196402628
[post] =>
)
)
I want to store [data:protected][field_data] in database so i want to read this array but when i try to echo like echo '-->'.$re['FacebookAds\Object\Lead Object']['data:protected'][field_data][0]['name']; it throws me an error.
How to read the above format?Any help would be greatly appreciated.
$form = new \FacebookAds\Object\Lead('LEAD_ID');
$form->read();
echo '<pre>';
print_r($form->getData());
Will give you
Array
(
[ad_id] =>
[ad_name] =>
[adset_id] =>
[adset_name] =>
[campaign_id] =>
[campaign_name] =>
[created_time] => 2016-09-18T06:57:13+0000
[custom_disclaimer_responses] =>
[field_data] => Array
(
[0] => Array
(
[name] => full_name
[values] => Array
(
[0] =>
)
)
[1] => Array
(
[name] => email
[values] => Array
(
[0] => test#fb.com
)
)
[2] => Array
(
[name] => phone_number
[values] => Array
(
[0] =>
)
)
)
[form_id] =>
[id] => 1681384948848301
[is_organic] =>
[post] =>
)

retrieving data from a php object

I am trying to access data inside a php object. I am confused about what the exact stynax is. Here is the output of the object:
stdClass Object ( [vid] => 10 [uid] => 1 [title] => Beachhead Don [log] =>
[status] => 1 [comment] => 1 [promote] => 0 [sticky] => 0 [ds_switch] => [nid] =>
10 [type] => product [language] => und [created] => 1357668665 [changed] => 1358198386
[tnid] => 0 [translate] => 0 [revision_timestamp] => 1358198386 [revision_uid] => 1
[model] => B 3000 [list_price] => 0.00000 [cost] => 0.00000 [sell_price] => 1.00000
[weight] => 0 [weight_units] => lb [length] => 0 [width] => 0 [height] => 0
[length_units] => in [pkg_qty] => 1 [default_qty] => 1 [unique_hash] =>
2eec0fcc8483f3a3541870fb24223296 [ordering] => 0 [shippable] => 0 [price] => 1.00000
[body] => Array ( [und] => Array ( [0] => Array ( [value] => Description info
))))))))))))))))))))))))))))))))))))))0 [summary] => [format] => filtered_html
[safe_value] =>Description info ))))))))))))))))))))))))))))))))))))))0[safe_summary]
=> ) ) ) [uc_product_image] => Array ( [und] => Array ( [0] => Array ( [fid] => 11
[alt] => [title] => [width] => 90 [height] => 120 [uid] => 1 [filename] =>
beachhead_don.jpg [uri] => public://beachhead_don.jpg [filemime] => image/jpeg
[filesize] => 14342 [status] => 1 [timestamp] => 1357668665 [rdf_mapping] => Array ( )
) ) ) [field_author] => Array ( [und] => Array ( [0] => Array ( [value] => John B.
Romesier [format] => [safe_value] => John B. Romesier ) ) ) [field_publisher] => Array
( [und] => Array ( [0] => Array ( [value] => Unknown [format] => [safe_value] =>
Unknown ) ) ) [field_release_date] => Array ( [und] => Array ( [0] => Array ( [value]
=> Mar 2012 [format] => [safe_value] => Mar 2012 ) ) ) [field_number_of_pages] => Array
( [und] => Array ( [0] => Array ( [value] => 123 ) ) ) [field_catagory] => Array (
[und] => Array ( [0] => Array ( [tid] => 4 ) ) ) [field_book_type] => Array ( [und] => Array ( [0] => Array ( [tid] => 1 ) ) ) [field_isbn] => Array ( ) [field_about_the_author] => Array ( [und] => Array ( [0] => Array ( [value] => Beachhed Don authoer............................ [format] => [safe_value] => Beachhed Don authoer............................ ) ) ) [rdf_mapping] => Array ( [rdftype] => Array ( [0] => sioc:Item [1] => foaf:Document ) [title] => Array ( [predicates] => Array ( [0] => dc:title ) ) [created] => Array ( [predicates] => Array ( [0] => dc:date [1] => dc:created ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) [changed] => Array ( [predicates] => Array ( [0] => dc:modified ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) [body] => Array ( [predicates] => Array ( [0] => content:encoded ) ) [uid] => Array ( [predicates] => Array ( [0] => sioc:has_creator ) [type] => rel ) [name] => Array ( [predicates] => Array ( [0] => foaf:name ) ) [comment_count] => Array ( [predicates] => Array ( [0] => sioc:num_replies ) [datatype] => xsd:integer ) [last_activity] => Array ( [predicates] => Array ( [0] => sioc:last_activity_date ) [datatype] => xsd:dateTime [callback] => date_iso8601 ) ) [cid] => 0 [last_comment_timestamp] => 1357668665 [last_comment_name] => [last_comment_uid] => 1 [comment_count] => 0 [name] => admin [picture] => 0 [data] => b:0; [entity_view_prepared] => 1 )
I am trying to retrive the [value] of Description info ))))))))))))))))))))))))))))))))))))))0
I tried this
<?php
$node = menu_get_object(); //drupal code
if ( !empty($node) ) {
print $node ->body=>und=>0=>value;
}?>
and got an error about the '=' sign. What is the proper way to get my data?
[body] and [und] are arrays, so access them like this:
echo $node->body['und'][0]['value'];
It should be:
$node->body['und'][0]['value']
'Body' and 'und' are Arrays and need to be accessed with array syntax([]).
Accessing these values directly is sometimes frowned upon in drupal. You may want to look into: http://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_render/7

Categories