Why is my PHP string being converted to 1?

Posted by animuson on Stack Overflow See other posts from Stack Overflow or by animuson
Published on 2010-04-25T03:34:45Z Indexed on 2010/04/25 3:43 UTC
Read the original article Hit count: 299

Filed under:
|
|
|

Ok, so here's the quick rundown. I have a function to generate the page numbers.

This:

<?php
die($ani->e->tmpl->pages("/archive", 1, 15, 1, true));
?>

will output Single Page like expected.

But this:

<?php
$page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true);
?>
<?= $page_numbers ?>

will output a simple 1 to the page. Why is it getting converted to a 1? I would expect it to store the 'Single Page' string to the page_numbers variable and then output it (like an echo) exactly the same.

EDIT: Running a var_dump($page_numbers) returns int(1)...

Here is the entire function in context:

<?php
// other functions...
function show_list() {
    global $ani;
    $page_numbers = $ani->e->tmpl->pages("/archive", 1, 15, 1, true);
    ob_start();
?>
<!-- content:start -->
<?php
    $archive_result = $ani->e->db->build(array("select" => "*", "from" => "animuson_archive", "orderby" => "0-time", "limit" => 15));
    while ($archive = $ani->e->db->fetch($archive_result)) {
?>
<h2><a href="/archive/article/<?= $archive['aid'] ?>/<?= $archive['title_nice'] ?>"><?= $archive['title'] ?></a></h2>
<!-- breaker -->
<?php
    }
?>
<?= var_dump($page_numbers) ?>
<!-- content:stop -->
<?php
    $ani->e->tmpl->process("box", ob_get_clean());
}
// other functions...
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about string