Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- 공모주 청약 일정
- MYSQL
- html
- 6월 공모주 청약 일정
- css
- IPO
- Eclipse
- 주식 청약
- 주식 청약 일정
- 공모주 청약
- 7월 공모주 청약 일정
- 자바
- 리눅스
- Stock
- linux
- Stock ipo
- JavaScript
- Oracle
- 주식
- codeigniter
- jquery
- 코드이그나이터
- 자바스크립트
- SQL
- php
- 제이쿼리
- 오라클
- java
- 공모주
- 맥
Archives
- Today
- Total
개발자의 끄적끄적
[php] php array shuffle 함수 본문
728x90
반응형
[php] php array shuffle 함수
function custom_shuffle($my_array = array()) {
$copy = array();
while (count($my_array)) {
// takes a rand array elements by its key
$element = array_rand($my_array);
// assign the array and its value to an another array
$copy[$element] = $my_array[$element];
//delete the element from source array
unset($my_array[$element]);
}
return $copy;
}
$new_aarray = custom_shuffle($old_array);
이런식으로 호출해서 사용하면 됩니다!!!
자주 사용되니 참고 하세요!!
반응형
'개발 > php' 카테고리의 다른 글
| [php] php 배열 관련 함수 모음 (0) | 2019.10.04 |
|---|---|
| [php] php email 체크 정규식 (0) | 2019.10.03 |
| [php] php strpos 문자열 포함여부 함수 (0) | 2019.09.30 |
| [php] php intval 정수형으로 변환 함수 (0) | 2019.09.29 |
| [php] php round 반올림 함수 (0) | 2019.09.29 |
Comments
