Get value with column names in cassandra - php

Hi I am using php with cassandra database. I am trying to get username and password from cassandra database. It return the below result.
Cassandra\Rows Object(
[columns:protected] => Array
(
[0] => Cassandra\ColumnSpec Object
(
[keyspace:protected] => team1_groupboxx
[tablename:protected] => gb_adminusers
[name:protected] => au_username
[type:protected] => Cassandra\TypeSpec Object
(
[type:protected] => 13
[customTypename:protected] =>
[keyType:protected] =>
[valueType:protected] =>
)
)
[1] => Cassandra\ColumnSpec Object
(
[keyspace:protected] => team1_groupboxx
[tablename:protected] => gb_adminusers
[name:protected] => au_password
[type:protected] => Cassandra\TypeSpec Object
(
[type:protected] => 13
[customTypename:protected] =>
[keyType:protected] =>
[valueType:protected] =>
)
)
)
[rowCount:protected] => 1
[columnCount:protected] => 2
[current:protected] => 0
[rows:protected] => Array
(
[0] => Array
(
[0] => k2badmin
[1] => f2c452187d4af19966187e15f1e944e1
)
)
)
But I want to get the query result in below format.
Array (
[au_username] => admin
[au_password] => f2c452187d4af19966187e15f1e944er
)
where au_username and au_password are the column names of my table.

Related

Unable to get or display received sms using plivo token and auth id in php

I'm working on the PHP script where I want to get and display all message which is received on the plivo number?
I have already tried two different methods which are not working
Please guide how do I get the your_message_uuid which is necessary in Method 1?
Method 1
require 'vendor/autoload.php';
use Plivo\RestClient;
$client = new RestClient("auth id", "auth_token");
$response = $client->messages->get('your_message_uuid');
print_r($response);
Method 2
require 'vendor/autoload.php';
use Plivo\RestClient;
$client = new RestClient("auth id", "auth_token");
$response = $client->messages->list(
[
'limit' => 5,
'offset' => 0,
'subaccount' =>'subaccount_auth_id'
]
);
print_r($response);
// Prints only the message_uuid
print_r($response->getmessageUuid(0));
Result Using Method 1
Plivo\Resources\Message\Message Object ( [client:protected] => Plivo\BaseClient Object ( [timeout:protected] => [httpClientHandler:protected] => Plivo\HttpClients\PlivoGuzzleHttpClient Object ( [guzzleClient:protected] => GuzzleHttp\Client Object ( [config:GuzzleHttp\Client:private] => Array ( [handler] => GuzzleHttp\HandlerStack Object ( [handler:GuzzleHttp\HandlerStack:private] => Closure Object ( [static] => Array ( [default] => GuzzleHttp\Handler\CurlMultiHandler Object ( [factory:GuzzleHttp\Handler\CurlMultiHandler:private] => GuzzleHttp\Handler\CurlFactory Object ( [handles:GuzzleHttp\Handler\CurlFactory:private] => Array ( ) [maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 50 ) [selectTimeout:GuzzleHttp\Handler\CurlMultiHandler:private] => 1 [active:GuzzleHttp\Handler\CurlMultiHandler:private] => [handles:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) [delays:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) [options:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) ) [sync] => GuzzleHttp\Handler\CurlHandler Object ( [factory:GuzzleHttp\Handler\CurlHandler:private] => GuzzleHttp\Handler\CurlFactory Object ( [handles:GuzzleHttp\Handler\CurlFactory:private] => Array ( [0] => Resource id #55 ) [maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 3 ) ) ) [parameter] => Array ( [$request] => [$options] => ) ) [stack:GuzzleHttp\HandlerStack:private] => Array ( [0] => Array ( [0] => Closure Object ( [parameter] => Array ( [$handler] => ) ) [1] => http_errors ) [1] => Array ( [0] => Closure Object ( [parameter] => Array ( [$handler] => ) ) [1] => allow_redirects ) [2] => Array ( [0] => Closure Object ( [parameter] => Array ( [$handler] => ) ) [1] => cookies ) [3] => Array ( [0] => Closure Object ( [parameter] => Array ( [$handler] => ) ) [1] => prepare_body ) ) [cached:GuzzleHttp\HandlerStack:private] => Closure Object ( [static] => Array ( [handler] => GuzzleHttp\RedirectMiddleware Object ( [nextHandler:GuzzleHttp\RedirectMiddleware:private] => Closure Object ( [static] => Array ( [handler] => GuzzleHttp\PrepareBodyMiddleware Object ( [nextHandler:GuzzleHttp\PrepareBodyMiddleware:private] => Closure Object ( [static] => Array ( [default] => GuzzleHttp\Handler\CurlMultiHandler Object ( [factory:GuzzleHttp\Handler\CurlMultiHandler:private] => GuzzleHttp\Handler\CurlFactory Object ( [handles:GuzzleHttp\Handler\CurlFactory:private] => Array ( ) [maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 50 ) [selectTimeout:GuzzleHttp\Handler\CurlMultiHandler:private] => 1 [active:GuzzleHttp\Handler\CurlMultiHandler:private] => [handles:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) [delays:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) [options:GuzzleHttp\Handler\CurlMultiHandler:private] => Array ( ) ) [sync] => GuzzleHttp\Handler\CurlHandler Object ( [factory:GuzzleHttp\Handler\CurlHandler:private] => GuzzleHttp\Handler\CurlFactory Object ( [handles:GuzzleHttp\Handler\CurlFactory:private] => Array ( [0] => Resource id #55 ) [maxHandles:GuzzleHttp\Handler\CurlFactory:private] => 3 ) ) ) [parameter] => Array ( [$request] => [$options] => ) ) ) ) [parameter] => Array ( [$request] => [$options] => ) ) ) ) [parameter] => Array ( [$request] => [$options] => ) ) ) [allow_redirects] => Array ( [max] => 5 [protocols] => Array ( [0] => http [1] => https ) [strict] => [referer] => [track_redirects] => ) [http_errors] => 1 [decode_content] => 1 [verify] => 1 [cookies] => [idn_conversion] => 1 [headers] => Array ( [User-Agent] => GuzzleHttp/6.5.5 curl/7.75.0 PHP/7.2.34 ) ) ) [authId:protected] => [authToken:protected] => ) [basicAuth:protected] => Plivo\Authentication\BasicAuth Object ( [authId:protected] => [authToken:protected] => ) ) [interface:protected] => [id:protected] => [pathParams:protected] => Array ( [authId] => [messageUuid] => ) [properties] => Array ( [from] => [to] => [messageDirection] => [messageState] => [messageTime] => [messageType] => [messageUuid] => [resourceUri] => [totalAmount] => [totalRate] => [units] => ) )
Empty Result Using Method 2
Check out Plivo's use case guide to receiving SMS messages. It explains how to
create a PHP app to read the message content
create a Plivo SMS app and assign the PHP app to it
assign the Plivo SMS app to a Plivo number (that will receive the
incoming SMS messages)
whenever an incoming SMS message is received on that Plivo number, Plivo
will send the details to his app server configured in the Plivo SMS
app (message URL)

php-xapi/client parse getStatements method object

I am using php-xapi/client library to get all the statements stored in LRS.
Code:
$results = $statementsApiClient->getStatements();
Document link:
https://github.com/php-xapi/client/blob/master/doc/statements.md
It returns the StatementResult object. But I'm not able to access it's private properties. Nothing is mentioned in their document.
Below is the output:
Xabbuh\XApi\Model\StatementResult Object
(
[statements:Xabbuh\XApi\Model\StatementResult:private] => Array
(
[0] => Xabbuh\XApi\Model\Statement Object
(
[id:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\StatementId Object
(
[uuid:Xabbuh\XApi\Model\StatementId:private] => Rhumsaa\Uuid\Uuid Object
(
[fields:protected] => Array
(
[time_low] => e994a27f
[time_mid] => cbfe
[time_hi_and_version] => 4272
[clock_seq_hi_and_reserved] => bf
[clock_seq_low] => d7
[node] => 147d334723b3
)
)
)
[verb:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Verb Object
(
[id:Xabbuh\XApi\Model\Verb:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => http://adlnet.gov/expapi/verbs/experienced
)
[display:Xabbuh\XApi\Model\Verb:private] => Xabbuh\XApi\Model\LanguageMap Object
(
[map:Xabbuh\XApi\Model\LanguageMap:private] => Array
(
[en-US] => experienced
)
)
)
[actor:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Agent Object
(
[iri:Xabbuh\XApi\Model\Actor:private] => Xabbuh\XApi\Model\InverseFunctionalIdentifier Object
(
[mbox:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => mailto:cwaghmare#xento.com
)
[mboxSha1Sum:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
[openId:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
[account:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
)
[name:Xabbuh\XApi\Model\Actor:private] => Chinmay
)
[object:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Activity Object
(
[id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => http:///68DFljpCPci
)
[definition:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\Definition Object
(
[name:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\LanguageMap Object
(
[map:Xabbuh\XApi\Model\LanguageMap:private] => Array
(
[und] => Video Slide 1
)
)
[description:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\LanguageMap Object
(
[map:Xabbuh\XApi\Model\LanguageMap:private] => Array
(
[und] => Video Slide 1
)
)
[type:Xabbuh\XApi\Model\Definition:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => http://adlnet.gov/expapi/activities/module
)
[moreInfo:Xabbuh\XApi\Model\Definition:private] =>
[extensions:Xabbuh\XApi\Model\Definition:private] =>
)
)
[result:Xabbuh\XApi\Model\Statement:private] =>
[authority:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Agent Object
(
[iri:Xabbuh\XApi\Model\Actor:private] => Xabbuh\XApi\Model\InverseFunctionalIdentifier Object
(
[mbox:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => mailto:hello#learninglocker.net
)
[mboxSha1Sum:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
[openId:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
[account:Xabbuh\XApi\Model\InverseFunctionalIdentifier:private] =>
)
[name:Xabbuh\XApi\Model\Actor:private] => New Client
)
[created:Xabbuh\XApi\Model\Statement:private] => DateTime Object
(
[date] => 2018-04-11 06:46:15.231000
[timezone_type] => 2
[timezone] => Z
)
[stored:Xabbuh\XApi\Model\Statement:private] => DateTime Object
(
[date] => 2018-04-11 06:46:14.746000
[timezone_type] => 2
[timezone] => Z
)
[context:Xabbuh\XApi\Model\Statement:private] => Xabbuh\XApi\Model\Context Object
(
[registration:Xabbuh\XApi\Model\Context:private] =>
[instructor:Xabbuh\XApi\Model\Context:private] =>
[team:Xabbuh\XApi\Model\Context:private] =>
[contextActivities:Xabbuh\XApi\Model\Context:private] => Xabbuh\XApi\Model\ContextActivities Object
(
[parentActivities:Xabbuh\XApi\Model\ContextActivities:private] => Array
(
[0] => Xabbuh\XApi\Model\Activity Object
(
[id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => http://
)
[definition:Xabbuh\XApi\Model\Activity:private] =>
)
)
[groupingActivities:Xabbuh\XApi\Model\ContextActivities:private] => Array
(
[0] => Xabbuh\XApi\Model\Activity Object
(
[id:Xabbuh\XApi\Model\Activity:private] => Xabbuh\XApi\Model\IRI Object
(
[value:Xabbuh\XApi\Model\IRI:private] => http://
)
[definition:Xabbuh\XApi\Model\Activity:private] =>
)
)
[categoryActivities:Xabbuh\XApi\Model\ContextActivities:private] =>
[otherActivities:Xabbuh\XApi\Model\ContextActivities:private] =>
)
[revision:Xabbuh\XApi\Model\Context:private] =>
[platform:Xabbuh\XApi\Model\Context:private] =>
[language:Xabbuh\XApi\Model\Context:private] =>
[statement:Xabbuh\XApi\Model\Context:private] =>
[extensions:Xabbuh\XApi\Model\Context:private] =>
)
[attachments:Xabbuh\XApi\Model\Statement:private] =>
)
)
[moreUrlPath:Xabbuh\XApi\Model\StatementResult:private] => Xabbuh\XApi\Model\IRL Object
(
[value:Xabbuh\XApi\Model\IRL:private] =>
)
)
How can I access Id, Actor and Verb properties of the above StatementResult Object?
Any help would be highy appreciated.
The StatementResult object does not contain those properties, it contains a list of statements where each of those objects will then contain those properties. You would need to call $statements = $results->getStatements(); to retrieve an array of the Statement objects, then access those properties (id, actor, etc.) via the Statement class interface. The individual model classes are defined in a separate repo, see https://github.com/php-xapi/model/tree/master/src.

I got this response from cleeng API ; how to convert this response to JSON

Cleeng_Entity_Collection Object
(
[entityType:protected] => Cleeng_Entity_SubscriptionOffer
[items:protected] => Array
(
[0] => Cleeng_Entity_SubscriptionOffer Object
(
[id:protected] => S955494970_US
[publisherEmail:protected] => vidya+mtc#ooyala.com
[url:protected] =>
[title:protected] => Annual subscription
[description:protected] =>
[period:protected] => year
[price:protected] => 49.99
[applicableTaxRate:protected] => 0
[currency:protected] => USD
[accessToTags:protected] => Array
(
[0] => d962607d3d4c4e3c98a343c7bcb64027
)
[active:protected] => 1
[createdAt:protected] => 1473681112
[updatedAt:protected] => 1473858745
[geoRestrictionEnabled:protected] =>
[geoRestrictionType:protected] =>
[geoRestrictionCountries:protected] => Array
(
)
[pending:protected] =>
[country] => US
[socialCommissionRate] => 0
[averageRating] => 4
[contentType] =>
[freePeriods] => 0
[freeDays] => 0
[expiresAt] =>
)
)
[totalItemCount:protected] => 5
[pending:protected] =>
)
All you need to do is just convert the Collection to a Regular Array and then json_encode() the Result like so:
<?php
$entityCollection = "???"; // THIS IS THE DATA FROM Cleeng_Entity_Collection Object
$entityArray = $entityCollection->toArray();
$entityJSON = json_encode($entityArray);

Select Different Columns as a single result - MongoDB - PHP

How do I select 'peerIP' and 'client_ip' as IP address. (DATA given below)
I have gone this far.
$cursor = $collection->find();
$cursor->fields(array("payload.peerIP" => true, "payload.client_ip" => true, "payload.remote_host" => true, "payload.source" => true));
foreach ($cursor as $document) {
print_r($document['payload']);
}
which gives me:
Array ( [remote_host] => 00.00.00.000 )
Array ( [peerIP] => 000.00.000.00 )
.......
Array ( [client_ip] => 00.000.00.00 )
I am trying to achieve something like this:
Array ( [peerIP] => 00.00.00.000 )
Array ( [peerIP] => 000.00.000.00 )
.......
Array ( [peerIP] => 00.000.00.00 )
Any help? Is this even possible ?
DATA:
Array (
[session] => e283f2defa254228bb20527aeb334bf7
[peerIP] => 000.000.00.00
[commands] => Array ( )
[loggedin] => [startTime] => 2015-07-29T11:45:46.685927
[ttylog] => [hostPort] => 22 [peerPort] => 52963
[version] => SSH-2.0-libssh2_1.6.0
[urls] => Array ( )
[hostIP] => 127.0.0.1
[credentials] => Array (
[0] => Array (
[0] => root [1] => root ) )
[endTime] => 2015-07-29T11:45:49.976508
[unknownCommands] => Array ( ) )
Array ( [client_ip] => 000.00.000.00
[dist] => 23 [server_port] => 21
[timestamp] => 2015/07/31 02:41:04
[client_port] => 61447
[raw_sig] => 4:41+23:0:1400:63,0:mss,ws,sok,ts,eol+0::0
[params] => none
[server_ip] => 00.00.00.00
[subject] => cli [os] => ??? [mod] => syn )
PS: The values posted above are sys logs from different nodes, the outputs have different field names..

How do I extract the details from a PHP object?

I'm working with an object that returns information in a format like the following... I've removed some details where the information gets a little repetitive to save some space.
ISC_QUOTE_ITEM Object (
[type:protected] => 1
[id:protected] => 4cff5974138c9
[hash:protected] => cd2a8393493a286cf1fe97d92a947719
[productData:protected] =>
[productId:protected] => 28
[variationId:protected] => 0
[variationOptions:protected] => Array ( )
[quantity:protected] => 1
[originalOrderQuantity:protected] => 0
[name:protected] => Mac Pro
[basePrice:protected] => 2799.0000
[sku:protected] =>
[wrapping:protected] => Array ( )
[configuration:protected] => Array ( )
[eventDate:protected] => Array ( )
[eventName:protected] =>
[parentId:protected] =>
[quote:protected] => ISC_QUOTE Object (
[customerId:protected] =>
[customerGroupId:protected] =>
[discounts:protected] => Array ( )
[addresses:protected] => Array (
[4cff2f55b0fcd] => ISC_QUOTE_ADDRESS_SHIPPING Object (
[shippingMethod:protected] =>
[shippingCache:protected] =>
[handlingCost:protected] => 0
[quote:protected] => ISC_QUOTE Object *RECURSION*
[type:protected] => shipping
[id:protected] => 4cff2f55b0fcd
[firstName:protected] => asd
[lastName:protected] => asd
[company:protected] => asd
[phone:protected] => asd
[email:protected] => sz#gmail.com
[address1:protected] => asd
[address2:protected] =>
[zip:protected] => 62990
[city:protected] => asd
[state:protected] => Array (
[id] => 0
[iso2] =>
[name] => asd
)
[country:protected] => Array (
[id] => 99
[name] => India
[iso2] => IN
)
[cachedTotals:protected] => Array ( )
[customFields:protected] => Array ( )
[saveAddress:protected] =>
[customerAddressId:protected] => 0
)
[4cff2f55cc2b6] => ISC_QUOTE_ADDRESS Object (
[handlingCost:protected] =>
[quote:protected] => ISC_QUOTE Object *RECURSION*
[type:protected] => billing
[id:protected] => 4cff2f55cc2b6
[firstName:protected] => asd
[lastName:protected] => asd
[company:protected] => asd
[phone:protected] => asd
[email:protected] => sz#gmail.com
[address1:protected] => asd
[address2:protected] =>
[zip:protected] => 62990
[city:protected] => asd
[state:protected] => Array (
[id] => 0
[iso2] =>
[name] => asd
)
[country:protected] => Array (
[id] => 99
[name] => India
[iso2] => IN
)
[cachedTotals:protected] => Array ( )
[customFields:protected] => Array ( )
[saveAddress:protected] =>
[customerAddressId:protected] => 0
)
)
[coupons:protected] => Array ( )
[giftCertificates:protected] => Array ( )
[items:protected] => Array (
[0] => ISC_QUOTE_ITEM Object (
[type:protected] => 1
[id:protected] => 4cff2f55b11d2
[hash:protected] => 587e0ee453488554f782b20f3c928916
[productData:protected] =>
[productId:protected] => 24
[variationId:protected] => 0
[variationOptions:protected] => Array ( )
[quantity:protected] => 3
[originalOrderQuantity:protected] => 0
[name:protected] => Apple iPod Socks
[basePrice:protected] => 29.0000
[sku:protected] =>
[wrapping:protected] => Array ( )
[configuration:protected] => Array ( )
[eventDate:protected] => Array ( )
[eventName:protected] =>
[parentId:protected] =>
[quote:protected] => ISC_QUOTE Object *RECURSION*
[discounts:protected] => Array ( )
[isCustomPrice:protected] =>
[addressId:protected] => 4cff2f55b0fcd
[cachedTotals:protected] => Array ( )
[inQuote:protected] => 1
[inventoryChecking:protected] => 1
[weight:protected] => 1.0000
[fixedShippingCost:protected] => 0.0000
)
[1] => ISC_QUOTE_ITEM Object (
[type:protected] => 1
[id:protected] => 4cff58167d29f
[hash:protected] => 1da6aa898763172b8f7b9d8097d37f42
[productData:protected] =>
[productId:protected] => 23
[variationId:protected] => 0
[variationOptions:protected] => Array ( )
[quantity:protected] => 1
[originalOrderQuantity:protected] => 0
[name:protected] => Apple In-Ear Headphones with Remote and Mic
[basePrice:protected] => 79.0000
[sku:protected] =>
[wrapping:protected] => Array ( )
[configuration:protected] => Array ( )
[eventDate:protected] => Array ( )
[eventName:protected] =>
[parentId:protected] =>
[quote:protected] => ISC_QUOTE Object *RECURSION*
[discounts:protected] => Array ( )
[isCustomPrice:protected] =>
[addressId:protected] => 4cff2f55b0fcd
[cachedTotals:protected] => Array ( )
[inQuote:protected] => 1
[inventoryChecking:protected] => 1
[weight:protected] => 2.0000
[fixedShippingCost:protected] => 0.0000
)
[2] => ISC_QUOTE_ITEM Object *RECURSION*
)
[isSplitShipping:protected] =>
[cachedTotals:protected] => Array ( )
[hasFreeShipping:protected] =>
[appliedStoreCredit:protected] => 0
[appliedDiscountRules:protected] => Array ( )
[customerMessage:protected] =>
[staffNotes:protected] =>
[orderStatus:protected] => 0
[orderId:protected] =>
[discountsEnabled:protected] => 1
)
[discounts:protected] => Array ( )
[isCustomPrice:protected] =>
[addressId:protected] => 4cff2f55b0fcd
[cachedTotals:protected] => Array ( )
[inQuote:protected] => 1
[inventoryChecking:protected] => 1
[weight:protected] => 3.0000
[fixedShippingCost:protected] => 0.0000
)
I need to extract details such as ID, name, etc. so that it reads 4cff5974138c9, Mac Pro, etc. respectively. How can I do that?
You need to call a function of that class (of which ISC_QUOTE_ITEM is an object - say MyClass ) which returns the protected variable
Edit
It can be accessed. I was correct.
Like this -
Add a function inside your class MyClass if you don't already have one.
public function getName()
{
return $this->name;
}
And then in your code you can do this:-
echo $obj->getName();
Read http://php.net/manual/en/language.oop5.visibility.php for details on visibility of types of variables
You can do this by using the reflector construct:
Example taken from http://www.php.net/manual/en/reflectionclass.getproperties.php:
<?php
class Foo {
public $foo = 1;
protected $bar = 2;
private $baz = 3;
}
$foo = new Foo();
$reflect = new ReflectionClass($foo);
$props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED);
foreach ($props as $prop) {
print $prop->getName() . "\n";
}
var_dump($props);
?>
As you can see also the protected $bar is returned :) And have a look at http://www.php.net/manual/en/reflectionproperty.getvalue.php#98643 there it is shown how to return the value of a protected attribute.

Categories