GD77 Posted July 5, 2012 Share Posted July 5, 2012 $yyy; $metaDesc; $tst1="fkr"; class pg { public function yeh() { global $tst1; echo $tst1; } public function pg_Index(){ echo "tst3"; } public function pg_Company(){ echo "tst4"; } } //$mD_0=pg::pg_Index(); //$mD_1=pg::pg_Company(); $mD_5=pg::pg_Register(); if($yyy=='xxx'){$metaDesc=pg::yeh();} if($yyyy=='xxx'){$metaDesc=$mD_1;} if($yyy=='xxx'){$metaDesc="Registration Page";} print_r ("<meta name='description' content='".$metaDesc."' />"); //////////////////////////////////////////////// why the object of the class being echoed to the page by default? o.O why can't get the data from the object into the final $metaDesc? Quote Link to comment https://forums.phpfreaks.com/topic/265277-php-class-error/ Share on other sites More sharing options...
GD77 Posted July 5, 2012 Author Share Posted July 5, 2012 Used this: public function pg_Index(){ $mData="3info"; return $mData; } worked. Quote Link to comment https://forums.phpfreaks.com/topic/265277-php-class-error/#findComment-1359464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.