LoginSignup
0
0

More than 1 year has passed since last update.

【PHP】値があれば先頭にくっつける、無ければ何もしない

Last updated at Posted at 2022-02-17

コード

<?php

$before = '55';

$before1 = '';

$start = 'bbb:';

echo str_replace($before, '攻撃力:'.$before.'/', $before);

echo str_replace($before1, '攻撃力:'.$before1.'/', $before1);

結果

攻撃力:55/

※出力なし

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0