Read object/array in PHP - 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] =>
)

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

Unset values from a multidimensional array from object

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!!

Modify object serialize value

I want to change the below object serialize values for 'secret_key' and 'public_key' and then i have to unserialize again.
What is the best way to modify (without string replace option)?
__PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesReactionRule
[*parent] =>
[id] => 51
[*elementId] => 1
[weight] => 0
[settings] => Array
(
)
[name] => commerce_payment_commerce_stripe
[label] => Stripe
[plugin] => reaction rule
[active] => 1
[status] => 3
[dirty] =>
[module] => commerce_payment
[owner] => rules
[access_exposed] => 0
[data] => __PHP_Incomplete_Class Object
*RECURSION*
[tags] => Array
(
[0] => Commerce Payment
)
[*children] => Array
(
[0] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesAction
[*parent] => __PHP_Incomplete_Class Object
*RECURSION*
[id] =>
[*elementId] => 3
[weight] => 0
[settings] => Array
(
[commerce_order:select] => commerce-order
[payment_method] => Array
(
[method_id] => commerce_stripe
[settings] => Array
(
[stripe_currency] => USD
[secret_key] => sk_test_CCVVVVCC
[public_key] => pk_test_SDFFEFEF
[display_title] => Stripe
[cardonfile] => 1
[txn_type] => authorize
)
)
)
[*elementName] => commerce_payment_enable_commerce_stripe
)
)
[*info] => Array
(
)
[*conditions] => __PHP_Incomplete_Class Object
(
[__PHP_Incomplete_Class_Name] => RulesAnd
[*parent] => __PHP_Incomplete_Class Object
*RECURSION*
[id] =>
[*elementId] => 2
[weight] => 0
[settings] => Array
(
)
[*children] => Array
(
)
[*info] => Array
(
)
[*negate] =>
)
[*events] => Array
(
[0] => commerce_payment_methods
)
[*eventSettings] => Array
(
)
)

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

Pull out a PHP variable in a complex nested array (from a Drupal View) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Able to see a variable in print_r()'s output, but not sure how to access it in code
I've got a complex array variable called $data. I need to pull out one very buried value: [url] in [field_website]. Here's the raw print_r() output of the $data variable:
stdClass Object ( [node_title] => CMI2 [nid] => 3 [field_data_field_website_node_entity_type] => node [field_data_field_blog_node_entity_type] => node [field_data_field_rss_node_entity_type] => node [field_data_field_twitter_node_entity_type] => node [field_data_field_yammer_node_entity_type] => node [field_data_field_facebook_node_entity_type] => node [field_data_field_flickr_node_entity_type] => node [field_data_field_youtube_node_entity_type] => node [_field_data] => Array ( [nid] => Array ( [entity_type] => node [entity] => stdClass Object ( [vid] => 3 [uid] => 1 [title] => CMI2 [log] => [status] => 1 [comment] => 1 [promote] => 0 [sticky] => 0 [nid] => 3 [type] => social_source [language] => und [created] => 1356040541 [changed] => 1356040541 [tnid] => 0 [translate] => 0 [revision_timestamp] => 1356040541 [revision_uid] => 1 [field_website] => Array ( [und] => Array ( [0] => Array ( [url] => http://cmi2.yale.edu [title] => [attributes] => Array ( ) ) ) ) [field_blog] => Array ( ) [field_rss] => Array ( ) [field_twitter] => Array ( [und] => Array ( [0] => Array ( [url] => http://twitter.com/yalecmi2 [title] => [attributes] => Array ( ) ) ) ) [field_facebook] => Array ( ) [field_youtube] => Array ( ) [field_flickr] => Array ( ) [field_yammer] => Array ( ) [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] => 1356040541 [last_comment_name] => [last_comment_uid] => 1 [comment_count] => 0 [name] => admin [picture] => 0 [data] => b:0; ) ) ) [field_field_website] => Array ( [0] => Array ( [rendered] => Array ( [#markup] => http://cmi2.yale.edu [#access] => 1 ) [raw] => Array ( [url] => http://cmi2.yale.edu [title] => http://cmi2.yale.edu [attributes] => Array ( ) [display_url] => http://cmi2.yale.edu ) ) ) [field_field_blog] => Array ( ) [field_field_rss] => Array ( ) [field_field_twitter] => Array ( [0] => Array ( [rendered] => Array ( [#markup] => http://twitter.com/yalecmi2 [#access] => 1 ) [raw] => Array ( [url] => http://twitter.com/yalecmi2 [title] => http://twitter.com/yalecmi2 [attributes] => Array ( ) [display_url] => http://twitter.com/yalecmi2 ) ) ) [field_field_yammer] => Array ( ) [field_field_facebook] => Array ( ) [field_field_flickr] => Array ( ) [field_field_youtube] => Array ( ) )
(sorry about that ugliness!)
How the heck do I pull out that [url] variable?! Ideally, I just want to assign that one value to another variable or just print it out.
If it's helpful, this is from a Drupal 7 view with the Views PHP module.
Thanks!
I recommend reading up about PHP arrays and objects since what you are trying to do is so trivial.
http://php.net/manual/en/language.types.array.php
http://php.net/manual/en/sdo.sample.getset.php

Categories