我有一块不能运行的PHP代码

<?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items): ?>
    <input type="hidden" name="<?php echo $i. '(rowid)'; ?>" value="<?php echo $items('rowid'); ?>" />
    <tr>
        <td><input type="text" name="<?php echo $i.'(qty)'; ?>" value="<?php echo $items('qty'); ?>" maxlength="3" /> </td>
        <td><?php echo $items('name'); ?></td>
        <td style="text-align:right"><?php echo $this->cart->format_number($items(price)); ?></td>
    </tr>
    <?php $i++; ?>
<?php endforeach; ?>
<tr>
    <td></td>
    <td class="right"><strong>Total</strong></td>
    <td class="right" style="text-align:right">$<?php echo $this->cart->format_number($this->cart->total()); ?> </td>

</tr>

I have a block of code above that will not function and is giving an error.

I would appreciate it if someone can take a look at it.

The error that I get:

Message: Function name must be a string

$items('rowid') need to be $items['rowid'] and same for others

Code need to be:-

<?php $i = 1; ?>
  <?php foreach ($this->cart->contents() as $items): ?>
      <input type="hidden" name="<?php echo $i. '(rowid)'; ?>" value="<?php echo $items['rowid']; ?>" />
      <tr>
        <td><input type="text" name="<?php echo $i.'(qty)'; ?>" value="<?php echo $items['qty']; ?>" maxlength="3" /> </td>
        <td><?php echo $items['name']; ?></td>
        <td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td>
      </tr>
  <?php $i++; ?>
<?php endforeach; ?>
<tr>
<td></td>
<td class="right"><strong>Total</strong></td>
<td class="right" style="text-align:right">$<?php echo $this->cart->format_number($this->cart->total()); ?> </td>

if you are getting $items as object then you can access the element of $items as $items->rowid.

if you are getting $items as array then you can access the element of $items as $items['rowid'].