Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use vsprintf with non array as arguments

Tags:

php

echo vsprintf('%s', 'word');

According to manual, second parameter for vsprintf() function must be array.

But this works, its normal? this may cause some error sometime?

like image 666
Oto Shavadze Avatar asked Dec 30 '25 18:12

Oto Shavadze


1 Answers

The $args argument is automatically cast to an array:

$args = (array)$args;                            // = array('word');
like image 67
silkfire Avatar answered Jan 01 '26 06:01

silkfire



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!