本文整理汇总了PHP中QString::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP QString::__toString方法的具体用法?PHP QString::__toString怎么用?PHP QString::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QString
的用法示例。
在下文中一共展示了QString::__toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: QString
function test_clear()
{
$s1 = new QString("hello");
$s1->clear();
$this->assertEquals($s1->__toString(), "", "Could not clear()!");
echo "\ntesting QString::clear() passed";
}
示例2: QString
$QString_1 = new QString("I'm a test!");
/* ASCII as parameter */
$QString_2 = new QString(40);
$QString_3 = new QString(41);
/* this work: */
echo $QString_2;
echo $QString_1;
echo $QString_3;
echo "\n";
/* this does not work */
echo $QString_2 . "-" . $QString_1 . "-" . $QString_3;
echo "\n";
/* this does not work */
$tmp = $QString_2 . "+" . $QString_1 . "+" . $QString_3;
print $tmp;
echo "\n";
/* this does not work */
$tmp2 = $QString_2;
$tmp2 .= $QString_1;
$tmp2 .= $QString_3;
echo $tmp2;
echo "\n";
/* this does not work */
echo "{$QString_2}#{$QString_1}#{$QString_3}";
echo "\n";
/* this work: */
$var1 = $QString_1->__toString();
$var2 = $QString_2->__toString();
$var3 = $QString_3->__toString();
print $var2 . " " . $var1 . " " . $var3;
echo "\n";
示例3: testQStringAppendObject
/**
* appending a QString to another QString:
* <code>$firstString->append( $secondString )</code>
*/
function testQStringAppendObject()
{
echo "\ntesting QString::append(new QString(\"hello\"))";
$s = new QString("hello");
$t = new QString(" world");
$s->append($t);
$this->assertEquals($s->__toString(), "hello world", "Could not append QString to QString!");
echo " passed";
}