What does %S mean in PHP, HTML or XML?

前端 未结 5 840
無奈伤痛
無奈伤痛 2021-02-01 14:55

I\'m looking at Webmonkey\'s PHP and MySql Tutorial, Lesson 2. I think it\'s a php literal. What does %s mean? It\'s inside the print_f() function i

5条回答
  •  清歌不尽
    2021-02-01 15:36

    $num = 5; 
    $location = 'tree';
    
    $format = 'There are %d monkeys in the %s'; 
    echo sprintf($format, $num, $location); 
    

    Will output: "There are 5 monkeys in the tree."

提交回复
热议问题