php


How could I access an object value


I have a PHP variable called $highlightings which carries highlighting solr response object. The var_dump of that variable prints out the following:
object(stdClass)#35 (10) {
["9955-97-43-7"]=>
object(stdClass)#36 (1) {
["Content"]=>
array(1) {
[0]=>
string(216) " أن يتزوج من الجارية إلا في حالة عدم التمكن من التزوج من الحرة انظر : جامع البيان : 5/7 ، زاد المسير في <span class="highlight">علم</span>"
}
}
["9955-81-27-7"]=>
object(stdClass)#37 (1) {
["Content"]=>
array(1) {
[0]=>
string(176) " <span class="highlight">العلمية</span> ، بيروت ) . المغني لابن قدامة : 4/25 .
(2) - صحيح مسلم : 3/1211 ، البحر الرائق : 6/210 ."
}
}.....
I want to access the first string of that object (216 length) but I could not. I tried:
$highlightings["9955-97-43-7"]->Content[0]
Since the parent is an object with a hypenated propety, try to use {}:
echo $highlightings->{'9955-97-43-7'}->Content[0];

Related Links

batch processing with Google Contacts API - PHP
Concrete5.7: Expose “Design” toolbar for anon?
Message dialog if PHP function successful or not
Fibonacci Sequence - PHP shortest code possible
PDO Pagination Error
Duplicate values inserted into database [closed]
Adding a list of dates to a database
SOAP client function : how to pass attributes
Is it okay to always use same variable (e.g. $stmt) for PDO queries?
Login Page Objective c/mysql
Laravel 5 Middleware “Owner”?
insert json data from the twitter api then into mongodb using php
Stop Facebook probing a site for content with PHP
PhpStorm remote debug with xdebug
Wordpress single post not showing content
Rate system warning mysql_fetch_assoc?

Categories

HOME
amazon-web-services
apache-nifi
xcode8.1
adobe
biztalk
apk
lvm
biztalk-2010
drag-and-drop
visualforce
linker
bittorrent
google-search-console
gprs
telegraf
fireloop
colors
phonegap-build
xsl-fo
raml
pe
batch-rename
chronicle-queue
dragula
jpa-2.1
unrar
adapter
tsung
materialize
d3.js-v4
om-next
listjs
restful-architecture
xerces-c
numerics
landscape
nsuserdefaults
strapi
system-on-chip
latexml
git-tfs
oracle-bmcs
.net-micro-framework
icecast
nonlinear-functions
datediff
watir-webdriver
mongodb-aggregation
gnome-terminal
http-basic-authentication
between
dpkg
android-4.2-jelly-bean
bbc-micro
gnucash
timestamping
textblock
utf-16
polymerfire
psd
bayesglm
directx-9
apple
fantom
abstract-factory
mathematical-expressions
maven-shade-plugin
nesper
csslint
bittorrent-sync
pageviews
cidr
roxy-fileman
principalcontext
armv6
xsd2code
yii-booster
sunstudio
rikulo
oembed
gitx
struts2-s2hibernate
dropshadow
drawimage
filelock
uipasteboard
azure-acs
jquery-1.4
active-record-query
fxruby
rakudo
error-detection

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile