What will be the output of the following PHP code?
<?php class ShopProductWriter { public function write($shopProduct) { $str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})n"; print $str; } } $product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 ); $writer = new ShopProductWriter(); $writer->write( $product1 ); ?>
A.Error
B.Cather: Willa My Antonia (5.99)
C.Willa: Cather My Antonia (5.99)
D.My Antonia: Willa Cather (5.99)
Answers
Answered by
0
I think D is the right answer
Answered by
0
Hey !
______________________________
What will be the output of the following PHP code?
<?php class ShopProductWriter { public function write($shopProduct) { $str = "{$shopProduct->title}: " .$shopProduct->getProducer() ." ({$shopProduct->price})n"; print $str; } } $product1 = new ShopProduct( "My Antonia", "Willa", "Cather", 5.99 ); $writer = new ShopProductWriter(); $writer->write( $product1 ); ?>
A.Error
B.Cather: Willa My Antonia (5.99)
C.Willa: Cather My Antonia (5.99)
D.My Antonia: Willa Cather (5.99)
______________________________
Thanks !
Similar questions
English,
6 months ago
Science,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago
Science,
1 year ago