Skip to main content
Code Review

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post this post

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post

added more comments
Source Link
azngunit81
  • 1.2k
  • 1
  • 12
  • 19

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

Also $_POST != null would typically be !isset($_POST) rather as explained in this post

Source Link
azngunit81
  • 1.2k
  • 1
  • 12
  • 19

One thing I would do is that str_replace can receive an array of items to look for and an array of its replacement:

PHP str_replace

// Provides: You should eat pizza, beer, and ice cream every day
$phrase = "You should eat fruits, vegetables, and fiber every day.";
$healthy = array("fruits", "vegetables", "fiber");
$yummy = array("pizza", "beer", "ice cream");
$newphrase = str_replace($healthy, $yummy, $phrase);

instead of going line by line to do it.

Just nit-picking but

sizeof() is an alias of count() and count() is more widely used, so use something that is more general in the PHP community

lang-php

AltStyle によって変換されたページ (->オリジナル) /