Skip to main content

All Questions

Tagged with
0 votes
0 answers
184 views

sprintf - Unknown format specifier "P"

I need to sometimes display the text of the discount directly and sometimes replace the numerical value. When the text is generated the system will do something like "Discount is %s". When ...
tomasr's user avatar
  • 367
0 votes
1 answer
79 views

which function is used for only taking up to 2 decimal and do not round value? [duplicate]

I have an issue that I do not want to round the calculated values. For example: I have used bcdiv, bcmul, bcsub functions and $formattedValue = sprintf("%.2f", $numericValue); function - is ...
Nector Family's user avatar
0 votes
0 answers
17 views

How to break a line using a PHP printf code [duplicate]

I have the following printf statement printf( '<a href="%s" class="button header-right-button">%s</a>', esc_url($lets_talk_url), __('Let\'s Talk!...
Carmel Joy Celocia's user avatar
0 votes
1 answer
48 views

how to insert this background image url in printf php?

i want to add this background image : style="background-image: url( '<?php echo $this->video->category->image; ?>' );" inside /a href=""/ under this printf : printf( ...
user avatar
0 votes
2 answers
200 views

Generate 4 digit sequential numbers keeping leading 0's starting form a given number

I am trying to generate 4 digit sequential numbers starting from any given number. Where I am stuck is keeping the leading 0's as I'll need 4 digits all the time. Here is my code. $start = '0520'; for(...
Abhik's user avatar
  • 674
-2 votes
1 answer
95 views

What is faster in PHP: dechex() or sprintf("%x")?

What is the fastest way to convert a number to the hexadecimal representation in PHP: dechex($number) or sprintf("%x",$number)?
Sergey Beloglazov's user avatar
0 votes
1 answer
74 views

Images are not being displayed on php

I have a txt file that has in it a painting id. This painting id is the same as the name of the image. For example in the txt file the painting id is 00000 and the name of the images in the path I ...
user16218933's user avatar
0 votes
0 answers
24 views

How can I put a % after %1$d in sprintf? [duplicate]

I have this sprintf based string: <?php echo sprintf( 'Over %1$d (warning) and %2$d (bad) are recorded', 75, 90 ); ?> It outputs: Over 75 (warning) and 90 (bad) are recorded How can I make this ...
bigdaveygeorge's user avatar
0 votes
1 answer
66 views

Multidimensional array to string conversion with custom format

Dear, I have a multidimensional array and I need to write the information contained therein in a text file, but in a customized way because I have another program to read this information and I cannot ...
David's user avatar
  • 725
-1 votes
1 answer
258 views

PHP - sprintf with multiple url values

I am using sprintf() PHP function and trying to format this url like: "/api/v1/post/1/225883" I have: const API_URL = '/api/v1'; const POST_ENDPOINT = '/post'; $this->client->getId() $...
misafe's user avatar
  • 57
0 votes
1 answer
1k views

Wordpress : PHP Warning: sprintf(): Too few arguments

I have this warning : PHP Warning: sprintf(): Too few arguments in /var/www/wordpress/wp-includes/widgets.php on line 1193 This is the function it refers to in widgets.php : function the_widget( $...
Fayçal E's user avatar
-2 votes
1 answer
32 views

How to delete more record of one table in php?

In my database the Owning table has foreign key(Ownerid) which references the Owner id.After some steps I would like to delete all the Owner who's id isn't in the Owning table. I have learnt how to ...
jacky's user avatar
  • 81
1 vote
2 answers
249 views

sprintf (PHP) return unwanted character (×) [closed]

I tried the sprintf function in php, but the results were not as expected, add an undesirable character: https://localhost/item?item_id=abcd&redirect=https://www.google.com/×tamp=1616847526 ...
kacyt1801's user avatar
0 votes
2 answers
209 views

What does % mean when used in printf()? [duplicate]

I want to understand why name and value of input has '%' , I searched a lot and I didn't find what it means : ' full code : <body> <img src="1.jpg" alt="banner" style=&...
Reem's user avatar
  • 1
0 votes
0 answers
737 views

How to add Html tags with sprintf function

I want to add HTML tags with sprintf function. I want to inject HTML tags with "Has been added to your cart" but HTML is also getting printed on screen. Any leads? Thanks! My code is below: $...
uzairhanif's user avatar

15 30 50 per page
1
2 3 4 5
20