Skip to content

Add support for * width and precision in printf() #5432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nikic
Copy link
Member

@nikic nikic commented Apr 21, 2020

Adds support for * width and precision, following glibc semantics.

Together with #5436 it allows easily printing floats exactly as PHP would:

// Locale-sensitive using precision ini setting.
sprintf("%.*G", ini_get('precision'), $float);

// Locale-insensitive using serialize_precision ini setting.
sprintf("%.*H", ini_get('serialize_precision'), $float);

@nikic nikic changed the title Add support for * precision in printf() Add support for * width and precision in printf() Apr 22, 2020
@php-pulls php-pulls closed this in 0221b8b May 27, 2020
@carusogabriel
Copy link
Contributor

@nikic Shall we close https://bugs.php.net/bug.php?id=60755?

@nikic
Copy link
Member Author

nikic commented May 27, 2020

@carusogabriel Thanks for the reminder, done!

@carusogabriel carusogabriel added this to the PHP 8.0 milestone May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants